Description
Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2^x.
Examples
Input:
n = 1Output:
trueExplanation:
2^0 = 1
Input:
n = 16Output:
trueExplanation:
2^4 = 16
Input:
n = 3Output:
falseExplanation:
3 is not a power of 2.
Constraints
- •
-2³¹ ≤ n ≤ 2³¹ - 1