1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 06:51:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 15:21:05 +08:00
parent b84ae535b7
commit e730aa6794
2244 changed files with 8703 additions and 59499 deletions

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 1259,
"likes": 1263,
"dislikes": 52,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Sliding Window Maximum\", \"titleSlug\": \"sliding-window-maximum\", \"difficulty\": \"Hard\", \"translatedTitle\": null}, {\"title\": \"Jump Game VII\", \"titleSlug\": \"jump-game-vii\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
@@ -167,7 +167,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"41.5K\", \"totalSubmission\": \"97.4K\", \"totalAcceptedRaw\": 41530, \"totalSubmissionRaw\": 97448, \"acRate\": \"42.6%\"}",
"stats": "{\"totalAccepted\": \"41.6K\", \"totalSubmission\": \"97.6K\", \"totalAcceptedRaw\": 41608, \"totalSubmissionRaw\": 97604, \"acRate\": \"42.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."