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/arithmetic_slices2.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 other/arithmetic_slices2.rs (limited to 'other/arithmetic_slices2.rs') diff --git a/other/arithmetic_slices2.rs b/other/arithmetic_slices2.rs deleted file mode 100644 index 41162f0..0000000 --- a/other/arithmetic_slices2.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::collections::HashMap; -struct Solution; - -impl Solution { - pub fn number_of_arithmetic_slices(nums: Vec) -> i32 { - let (n, mut ans) = (nums.len(), 0); - let mut map: Vec> = Vec::with_capacity(n); - for i in 1..n { - for j in 0..i { - let diff: i64 = nums[i] as i64 - nums[j] as i64; - let count = match map.len() { - 0 => 0, - _ => *map[j].get(&diff).unwrap_or(&0) - }; - if map.len() < i + 1 { - let n = i - map.len() + 1; - map.extend(vec![HashMap::new(); n]); - } - map[i].entry(diff).and_modify(|x| *x += count + 1).or_insert(count + 1); - ans += count; - } - } - ans - } -} - -fn main() { - let nums = vec![2,4,6,8,10]; - print!("{}", Solution::number_of_arithmetic_slices(nums)); -} -- cgit v1.2.3