aboutsummaryrefslogtreecommitdiff
path: root/other/power_of_four.rs
diff options
context:
space:
mode:
Diffstat (limited to 'other/power_of_four.rs')
-rw-r--r--other/power_of_four.rs24
1 files changed, 0 insertions, 24 deletions
diff --git a/other/power_of_four.rs b/other/power_of_four.rs
deleted file mode 100644
index f20335f..0000000
--- a/other/power_of_four.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-//INCOMPLETE
-struct Solution;
-
-impl Solution {
- pub fn is_power_of_four(num: i32) -> bool {
- if num < 0 {
- return false;
- }
- let (ans, pos, ones) = (0, 1, 0);
- while num {
- if num & 1 {
- ans += 1;
- ones = pos;
- }
- num >>= 1;
- pos += 1;
- }
- ans == 1 && ones & 1
- }
-}
-
-fn main() {
- print!("{}", Solution::is_power_of_four(16));
-}