diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/min_difficulty_schedule.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/min_difficulty_schedule.cpp')
-rw-r--r-- | other/min_difficulty_schedule.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/other/min_difficulty_schedule.cpp b/other/min_difficulty_schedule.cpp deleted file mode 100644 index 40fab6e..0000000 --- a/other/min_difficulty_schedule.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "leetcode.h" -#include <algorithm> -#include <vector> - -class Solution { -public: - int minDifficulty(vector<int> &jobDifficulty, int d) { - int n = jobDifficulty.size(); - if (n < d) - return -1; - vector<int> dp(n, 1000), dp2(n), stack; - for (int i = 0; i < d; ++i) { - stack.clear(); - for (int j = i; j < n; j++) { - dp2[j] = j ? dp[j - 1] + jobDifficulty[j] : jobDifficulty[j]; - while (stack.size() && - jobDifficulty[stack.back()] <= jobDifficulty[j]) { - int k = stack.back(); - stack.pop_back(); - dp[j] = min(dp2[j], dp2[k] - jobDifficulty[k] + jobDifficulty[j]); - } - if (stack.size()) - dp2[j] = min(dp2[j], dp2[stack.back()]); - stack.push_back(j); - } - swap(dp, dp2); - } - return dp[n - 1]; - } -}; - -int main() { - Solution obj; - vector<int> jobDifficulty = {6, 5, 4, 3, 2, 1}; - cout << obj.minDifficulty(jobDifficulty, 2); -} |