update leetcode
This commit is contained in:
6
leetcode_rs/problems/p191/Cargo.toml
Normal file
6
leetcode_rs/problems/p191/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "p191"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
7
leetcode_rs/problems/p191/src/main.rs
Normal file
7
leetcode_rs/problems/p191/src/main.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
fn hamming_weight(n: i32) -> i32 {
|
||||
n.count_ones() as i32
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(hamming_weight(11), 3);
|
||||
}
|
||||
Reference in New Issue
Block a user