File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 69
69
| 219 | [ Contains Duplicate II] ( https://leetcode.com/problems/contains-duplicate-ii ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/ContainsDuplicateII.java ) |
70
70
| 225 | [ Implement Stack using Queues] ( https://leetcode.com/problems/implement-stack-using-queues ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/MyStack.java ) |
71
71
| 226 | [ Invert Binary Tree] ( https://leetcode.com/problems/invert-binary-tree ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/InvertBinaryTree.java ) |
72
- | 231 | [ Power of Two] ( https://leetcode.com/problems/power-of-two ) | Easy |
72
+ | 231 | [ Power of Two] ( https://leetcode.com/problems/power-of-two ) | Easy |
73
73
| 232 | [ Implement Queue Using Stacks] ( ) | Easy |
74
74
| 234 | [ Palindrome Linked Lists] ( https://leetcode.com/problems/palindrome-linked-list ) | Easy |
75
75
| 235 | [ Lowest Common Ancestor of a Binary Search Tree] ( https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree ) | Easy |
Original file line number Diff line number Diff line change
1
+ public class PowerOf2 {
2
+ public boolean isPowerOfTwo (int number ) {
3
+ if (number == 1 ) {
4
+ return true ;
5
+ } else if (number % 2 == 1 || number == 0 ) {
6
+ return false ;
7
+ }
8
+
9
+ return isPowerOfTwo (number / 2 );
10
+ }
11
+ }
You can’t perform that action at this time.
0 commit comments