1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-06 07:51:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2023-12-09 19:57:46 +08:00
parent 9bc4722a45
commit 3770b44d1e
4792 changed files with 10889 additions and 10886 deletions

View File

@@ -167,7 +167,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"13.8K\", \"totalSubmission\": \"34.1K\", \"totalAcceptedRaw\": 13826, \"totalSubmissionRaw\": 34091, \"acRate\": \"40.6%\"}",
"stats": "{\"totalAccepted\": \"13.8K\", \"totalSubmission\": \"34.1K\", \"totalAcceptedRaw\": 13831, \"totalSubmissionRaw\": 34099, \"acRate\": \"40.6%\"}",
"hints": [
"Let dp[i] be \"the maximum score to reach the end starting at index i\". The answer for dp[i] is nums[i] + max{dp[i+j]} for 1 <= j <= k. That gives an O(n*k) solution.",
"Instead of checking every j for every i, keep track of the largest dp[i] values in a heap and calculate dp[i] from right to left. When the largest value in the heap is out of bounds of the current index, remove it and keep checking."