Skip to content

Commit 8dfeb11

Browse files
solutions
1 parent a306cd2 commit 8dfeb11

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class Solution {
2+
public bool IsPowerOfFour(int n) {
3+
return n > 0 && (n & (n - 1)) == 0 && (n & 0xaaaaaaaa) == 0;
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
impl Solution {
2+
pub fn is_power_of_four(n: i32) -> bool {
3+
n > 0 && (n & (n - 1)) == 0 && (n & 0xaaaaaaaa_u32 as i32) == 0
4+
}
5+
}

0 commit comments

Comments
 (0)