Given an integer n, return true if it is a power of two. Pattern focus: Isolate Lowest Bit. A power of two has exactly one set bit, so isolating the lowest set bit is a natural test.
n = integer
true if n is a power of two
Example 1:
Input:
n = 16
Output:
true
Explanation:
16 is 2^4 and has exactly one set bit.
Example 2:
Input:
n = 3
Output:
false
Explanation:
3 is 11 in binary and has two set bits.