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/min_operations_x_zero.cpp | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 other/min_operations_x_zero.cpp (limited to 'other/min_operations_x_zero.cpp') diff --git a/other/min_operations_x_zero.cpp b/other/min_operations_x_zero.cpp deleted file mode 100644 index 011839e..0000000 --- a/other/min_operations_x_zero.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int minOperations(vector &nums, int x) { - unordered_map left; - int ans = INT_MAX; - for (auto i = 0, sum = 0; i < nums.size() && sum <= x; ++i) { - left[sum] = i; - sum += nums[i]; - } - for (int i = nums.size() - 1, sum = 0; i >= 0 && sum <= x; --i) { - auto it = left.find(x - sum); - if (it != end(left) && i + 1 >= it->second) - ans = min(ans, nums.size() - i - 1 + it->second); - sum += nums[i]; - } - return ans = INT_MAX ? -1 : ans; - } -}; - -int main() { - Solution obj; - vector nums = {1, 1, 4, 2, 3}; - int x = 5; - cout << obj.minOperations(nums, x); -} -- cgit v1.2.3