Power of Two (Leetcode 231)
Problem Link: https://leetcode.com/problems/power-of-two/
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
if(n==0):
return False
if(n&(n-1)==0):
return True
return False
PreviousNumber of 1 Bits (Leetcode 191)NextLongest Subarray With Maximum Bitwise AND (Leetcode 2419)
Last updated