You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Ques Link : https://leetcode.com/problems/power-of-two/
package com.nitin.bitwise;
public class PowerofTwo {
public static void main(String[] args) {
int n = 0;
System.out.println(isPowerOfTwo(n));
}
static boolean isPowerOfTwo(int n) {
boolean ans = n > 0 && (n & (n - 1)) == 0;
return ans;
}
// Note: if you somehow found this solution, can you please tell me why the solution, I written below why is not working wheather the upper one is working correctly. Let's me know please or (I'll find the ans on my own till you reach to this repo :) peace xD