rs: add «2997. Minimum Number of Operations to Make Array XOR Equal to K»
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
241e5f9aad
commit
a55a560f58
1 changed files with 5 additions and 0 deletions
|
@ -0,0 +1,5 @@
|
|||
impl Solution {
|
||||
pub fn min_operations(nums: Vec<i32>, k: i32) -> i32 {
|
||||
(k ^ nums.into_iter().reduce(|x, y| x ^ y).unwrap()).count_ones() as i32
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue