Power of Two
Total Accepted: 43421 Total Submissions: 130315 Difficulty: Easy
Given an integer, write a function to determine if it is a power of two.
class Solution {public: bool isPowerOfTwo(int n) { long long int m = n; return n==0 ? false : (m&(m-1))==0; }};
Next challenges: