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 a306cd2 commit 8dfeb11Copy full SHA for 8dfeb11
solutions/0300-0399/0342.power-of-four/Solution.cs
@@ -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
+}
solutions/0300-0399/0342.power-of-four/Solution.rs
+impl Solution {
+ pub fn is_power_of_four(n: i32) -> bool {
+ n > 0 && (n & (n - 1)) == 0 && (n & 0xaaaaaaaa_u32 as i32) == 0
0 commit comments