Skip to content

Commit da8d780

Browse files
authored
Merge pull request #911 from beingshub02/patch-1
Create Power_of_four.java
2 parents 1c6bb3c + 9f75981 commit da8d780

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

LeetCode/Power_of_four.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public boolean isPowerOfFour(int n) {
3+
if(n==0){
4+
return false;
5+
}
6+
if(n%4!=0 && n !=1){
7+
return false;
8+
}
9+
10+
if(n==1){
11+
return true;
12+
}
13+
else{
14+
return isPowerOfFour(n/4);
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)