Last updated 4 years ago
Was this helpful?
O(1), O(1)
class Solution { public boolean isPowerOfTwo(int n) { return ( n > 0 && ( (n & (n-1)) == 0)); } }