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