From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/set_mismatch.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 other/set_mismatch.rs (limited to 'other/set_mismatch.rs') diff --git a/other/set_mismatch.rs b/other/set_mismatch.rs deleted file mode 100644 index b490f8e..0000000 --- a/other/set_mismatch.rs +++ /dev/null @@ -1,37 +0,0 @@ -struct Solution; - -impl Solution { - pub fn find_error_nums(nums: Vec) -> Vec { - let mut xor = nums.iter().zip(1..=nums.len() as i32).fold(0, |acc, (&num, i)| acc ^ num ^ i); - xor &= -xor; - let (mut n0, mut n1) = (0, 0); - for &n in &nums { - if n & xor == 0 { - n0 ^= n; - } else { - n1 ^= n; - } - } - for i in 1..=nums.len() as i32 { - if i & xor == 0 { - n0 ^= i; - } else { - n1 ^= i; - } - } - for &n in &nums { - if n == n0 { - return vec![n0, n1]; - } - if n == n1 { - return vec![n1, n0]; - } - } - unreachable!() - } -} - -fn main() { - let nums = vec![1,2,2,4]; - print!("{:?}", Solution::find_error_nums(nums)); -} -- cgit v1.2.3