knakul853

Untitled

Jul 19th, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.16 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     bool isPowerOfTwo(int n) {
  4.        
  5.         if(n <=0) return false;
  6.        
  7.         return (n & (n-1)) == 0;
  8.        
  9.     }
  10. };
Add Comment
Please, Sign In to add comment