class Solution {
    public boolean isPowerOfTwo(int n) {
        // Time complexity: proportion to log2(n) vs n vs constant
        if(n <= 0) return false;

        while(n != 1) {
            if(n % 2 != 0) return false;
            n = n / 2;
        }

        /*if(n == 1) return true;
        else return false;*/

        // return n == 1;
        return true;
    }
}