You are viewing a single comment's thread. Return to all comments →
Rust best solution If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions
fn misere_nim(s: &[i32]) -> String { //Time complexity: O(n) //Space complexity (ignoring input): O(1) let mut xor_sum = 0; let mut exist_column_over_1 = false; for &number in s { xor_sum ^= number; if number > 1 { exist_column_over_1 = true; } } if exist_column_over_1 { if xor_sum == 0 { return String::from("Second"); } else { return String::from("First"); } } else { if s.len() % 2 == 0 { return String::from("First"); } else { return String::from("Second"); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Misère Nim
You are viewing a single comment's thread. Return to all comments →
Rust best solution
If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions