20240204 Finished

This commit is contained in:
jackfiled 2024-02-04 10:37:50 +08:00
parent 495f019092
commit 44ea4b727a
2 changed files with 28 additions and 1 deletions

View File

@ -36,4 +36,5 @@ mod p2808_minimum_seconds_to_equalize_a_circular_array;
mod p2670_find_the_distinct_difference_array; mod p2670_find_the_distinct_difference_array;
mod lcp24_nums_game; mod lcp24_nums_game;
mod p1686_stone_game_vi; mod p1686_stone_game_vi;
mod p1690_stone_game_vii; mod p1690_stone_game_vii;
mod p292_nim_game;

View File

@ -0,0 +1,26 @@
/**
* [292] Nim Game
*/
pub struct Solution {}
// submission codes start here
impl Solution {
pub fn can_win_nim(n: i32) -> bool {
n % 4 != 0
}
}
// submission codes end
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_292() {
assert!(Solution::can_win_nim(5));
assert!(!Solution::can_win_nim(4));
}
}