231. Power of Two (Easy) - TengnanYao/daily_leetcode GitHub Wiki
class Solution(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
result = 1
while result <= n:
if result == n:
return True
else:
result *= 2
return False
# # binary solution
# return n > 0 and (n & n - 1) == 0