We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39b1c5a commit a670569Copy full SHA for a670569
June Challenge/com/leetcode/JuneChallenge/week2/PowerOfTwo.java
@@ -0,0 +1,14 @@
1
+package com.leetcode.JuneChallenge.week2;
2
+
3
+public class PowerOfTwo {
4
5
+ public boolean isPowerOfTwo(int n) {
6
+ return n > 0 && ((n & (n - 1)) == 0);
7
+ }
8
9
+ public static void main(String[] args) {
10
+ System.out.println(new PowerOfTwo().isPowerOfTwo(12));
11
+ System.out.println(new PowerOfTwo().isPowerOfTwo(11));
12
13
14
+}
0 commit comments