mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-09 15:59:06 +01:00
6 lines
105 B
Rust
6 lines
105 B
Rust
|
impl Solution {
|
||
|
pub fn is_power_of_two(n: i32) -> bool {
|
||
|
n > 0 && ((n - 1) & n) == 0
|
||
|
}
|
||
|
}
|