From dc1f0c4c0096013799416664894c5194dc7e1f52 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- works/solutions/leetcode/week/260/1.cpp | 21 --------------------- works/solutions/leetcode/week/260/2.cpp | 29 ----------------------------- 2 files changed, 50 deletions(-) delete mode 100644 works/solutions/leetcode/week/260/1.cpp delete mode 100644 works/solutions/leetcode/week/260/2.cpp (limited to 'works/solutions/leetcode/week') diff --git a/works/solutions/leetcode/week/260/1.cpp b/works/solutions/leetcode/week/260/1.cpp deleted file mode 100644 index 4d6c78d..0000000 --- a/works/solutions/leetcode/week/260/1.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using std::vector; - -class Solution { -public: - int maximumDifference(vector& nums) { - int result = -1; - - for (int i = 1; i < nums.size(); i++) { - for (int j = 0; j < i; j++) { - int diff = nums[i] - nums[j]; - if (diff > result) { - result = diff; - } - } - } - - return result == 0 ? -1 : result; - } -}; \ No newline at end of file diff --git a/works/solutions/leetcode/week/260/2.cpp b/works/solutions/leetcode/week/260/2.cpp deleted file mode 100644 index 86c4cf2..0000000 --- a/works/solutions/leetcode/week/260/2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using std::vector; - -#include -#include -#include - -class Solution { -public: - long long gridGame(vector> &grid) { - int s = grid.front().size(); - std::vector row0(grid[0].cbegin(), grid[0].cend()); - std::vector row1(grid[1].cbegin(), grid[1].cend()); - std::vector ps0, ps1; - - std::partial_sum(row0.cbegin(), row0.cend(), std::back_inserter(ps0)); - std::partial_sum(row1.cbegin(), row1.cend(), std::back_inserter(ps1)); - - long long r = std::numeric_limits::max(); - - for (int i = 0; i < s; i++) { - long long c = std::max(ps0.back() - ps0[i], i ? ps1[i - 1] : 0); - r = std::min(r, c); - } - - return r; - } -}; \ No newline at end of file -- cgit v1.2.3