Given an integer n, return true if it is a power of two. Otherwise, return false.

An integer n is a power of two, if there exists an integer x such that n == 2x.

&nbsp;
Example 1:

Input: n = 1
Output: true
Explanation: 20 = 1


Example 2:

Input: n = 16
Output: true
Explanation: 24 = 16


Example 3:

Input: n = 3
Output: false


&nbsp;
Constraints:


	-231 &lt;= n &lt;= 231 - 1


&nbsp;
Follow up: Could you solve it without loops/recursion?
class Solution:
    def isPowerOfTwo(self, n: int) -> bool:
        
         if n == 0: return False
        
         k = n
         while k != 1:
             if k % 2 != 0:
                 return False
             k = k // 2
            
            
         return True

        count = 0
        for i in range(33):
            mask = 1 << i
            
            if mask & n:
                count += 1
                
            if count > 1:
                return False
                
        if count == 1:
            return True
        return False
		
class Solution {
    public boolean isPowerOfTwo(int n) {
        return power2(0,n);

    }
    public boolean power2(int index,int n){
        if(Math.pow(2,index)==n)
            return true;
        if(Math.pow(2,index)>n)
            return false;
        return power2(index+1,n);
    }
}
class Solution {
public:
    bool isPowerOfTwo(int n) {
        if(n==0) return false;
        while(n%2==0) n/=2;
        return n==1;
    }
};
var isPowerOfTwo = function(n) {
    let i=1;
    while(i<n){
        i*=2
    }return i===n
};
Power of Two