All Posts

Leetcode 231: Power of Two

Given an integer n, determine if it is a power of two. An integer n is considered a power of two if there exists an integer x such that n == 2^x.

Leetcode 258: Add Digits

Given a non-negative integer num, repeatedly add all of its digits until the result has only one digit, and return it.

Leetcode 268: Missing Number

Given an array nums containing n distinct numbers, each in the range [0, n], return the only number in the range that is missing from the array.

Leetcode 279: Perfect Squares

Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is a number that is the square of an integer. Your goal is to determine the minimum number of perfect squares that sum up to the given integer n.

Leetcode 319: Bulb Switcher

There are n bulbs initially off. You toggle every ith bulb in the ith round, and at the end, you need to return how many bulbs remain on.

Leetcode 342: Power of Four

Given an integer n, return true if it is a power of four. Otherwise, return false. An integer n is a power of four if there exists an integer x such that n == 4^x.