def isPowerOfTwo(self, n):
return (n>0) and (n & (n-1))==0
hi what does (n & (n-1)) mean?
for example :n=8(1000b) n-1=7(0111b),
so n & n-1 ==0.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.