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/sum_subarr_mins.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 other/sum_subarr_mins.cpp (limited to 'other/sum_subarr_mins.cpp') diff --git a/other/sum_subarr_mins.cpp b/other/sum_subarr_mins.cpp deleted file mode 100644 index 8f90e37..0000000 --- a/other/sum_subarr_mins.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int sumSubarrayMins(vector &arr) { - vector s, sums(arr.size(), 0); - long j, ans = 0, mod = 1000000007; - for (int i = 0; i < arr.size(); ++i) { - while (!s.empty() && arr[s.back()] > arr[i]) - s.pop_back(); - j = !s.empty() ? s.back() : -1; - sums[i] = ((j >= 0 ? sums[j] : 0) + (i - j) * arr[i]) % mod; - s.push_back(i); - } - for (int i = 0; i < sums.size(); ++i) - ans = (ans + sums[i]) % mod; - return ans; - } -}; - -int main() { - Solution obj; - vector arr = { - 117, 1315, 1336, 4213, 5634, 6288, 7640, 8533, 9688, 10186, - 10593, 11896, 13673, 14707, 15484, 17429, 19639, 20416, 21375, 23601, - 25800, 26485, 27893, 28026, 28695, 29121, 28642, 28023, 27642, 26324, - 23844, 22069, 21124, 20181, 18957, 15736, 15364, 13749, 13612, 11062, - 10319, 9755, 9367, 7977, 6463, 6049, 4886, 3071, 1331, 865}; - cout << obj.sumSubarrayMins(arr); -} -- cgit v1.2.3