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.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 other/arithmetic_slices2.cpp (limited to 'other/arithmetic_slices2.cpp') diff --git a/other/arithmetic_slices2.cpp b/other/arithmetic_slices2.cpp deleted file mode 100644 index 38668b7..0000000 --- a/other/arithmetic_slices2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int numberOfArithmeticSlices(vector &nums) { - unordered_map> num_idx; - vvd dp(nums.size(), vector(nums.size())); - int ans = 0; - for (auto i = 0; i < nums.size(); ++i) - num_idx[nums[i]].push_back(i); - for (auto i = 0; i < nums.size(); ++i) { - for (int j = 0; j < i; j++) { - auto prev = 2l * nums[j] - nums[i]; - if (prev < INT_MIN || prev > INT_MAX) - continue; - auto it = num_idx.find(prev); - if (it != end(num_idx)) { - for (auto k : it->second) { - if (k >= j) - break; - dp[i][j] += dp[j][k] + 1; - } - } - ans += dp[i][j]; - } - } - return ans; - } -}; - -int main() { - Solution obj; - vector nums = {2, 4, 6, 8, 10}; - cout << obj.numberOfArithmeticSlices(nums); -} -- cgit v1.2.3