Skip to content

Commit 6f2073e

Browse files
authored
Create 0232_power_of_two.rs
1 parent b1d8b77 commit 6f2073e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rust/medium/0232_power_of_two.rs

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_two(n: i32) -> bool {
3+
n > 0 && n & (n - 1) == 0
4+
}
5+
}

0 commit comments

Comments
 (0)