1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +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\": \"103.4K\", \"totalSubmission\": \"226.2K\", \"totalAcceptedRaw\": 103440, \"totalSubmissionRaw\": 226184, \"acRate\": \"45.7%\"}",
"stats": "{\"totalAccepted\": \"103.4K\", \"totalSubmission\": \"226.2K\", \"totalAcceptedRaw\": 103441, \"totalSubmissionRaw\": 226185, \"acRate\": \"45.7%\"}",
"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."