Skip to content

Commit a670569

Browse files
author
shrinathjoshi
committed
Updated solution to day 8 of June Leetcode Challenge
1 parent 39b1c5a commit a670569

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)