mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
@@ -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."
|
||||
|
Reference in New Issue
Block a user