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_size_subarr_sum.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 other/min_size_subarr_sum.cpp (limited to 'other/min_size_subarr_sum.cpp') diff --git a/other/min_size_subarr_sum.cpp b/other/min_size_subarr_sum.cpp deleted file mode 100644 index 3e54b2b..0000000 --- a/other/min_size_subarr_sum.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// 209. Minimum Size Subarray Sum -#include "leetcode.h" - -/* - * given an array of positive integer 'nums' and a positive integer 'target', - * return the minimal length of a subarray whose sum is greater than or equal to - * 'target'. if there is no such subarray, return 0 instead. - */ - -class Solution { -public: - int minSubArrayLen(int target, vector &nums) { - int i = 0, n = nums.size(), ans = n + 1; - for (int j = 0; j < n; ++j) { - target -= nums[j]; - while (target <= 0) { - ans = min(ans, j - i + 1); - target += nums[i++]; - } - } - return ans % (n + 1); - } -}; - -int main() { - Solution obj; - vector n1 = {2, 3, 1, 2, 4, 3}, n2 = {1, 4, 4}, - n3 = {1, 1, 1, 1, 1, 1, 1, 1}; - printf("%d\n", obj.minSubArrayLen(7, n1)); // expect: 2 - printf("%d\n", obj.minSubArrayLen(4, n2)); // expect: 1 - printf("%d\n", obj.minSubArrayLen(11, n3)); // expect: 0 -} -- cgit v1.2.3