231. Power of Two
# Easy
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
tmp = 1
while tmp <= n:
if tmp == n:
return True
tmp *= 2
return False
Last updated
Was this helpful?