45. Power of Two
Easy
Given an integer numero, return true if it is a positive power of 2 and false otherwise. Consider 1 to also be a power of 2.
Example 1
Input: numero = 64
Output: true
Example 2
Input: numero = 18
Output: false
Explanation: 18 cannot be written as 2 raised to a non-negative integer exponent.
Constraints
- -2^31 <= numero <= 2^31 - 1
MathBits
Saved in this browser
Caso 1
numero =
64
Expected =
true
Caso 2
numero =
18
Expected =
false
Run checks these 2 cases. Submit runs all 6, including hidden ones.