mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> 和一个整数 <code>k</code> ,请你返回 <strong>非空</strong> 子序列元素和的最大值,子序列需要满足:子序列中每两个 <strong>相邻</strong> 的整数 <code>nums[i]</code> 和 <code>nums[j]</code> ,它们在原数组中的下标 <code>i</code> 和 <code>j</code> 满足 <code>i < j</code> 且 <code>j - i <= k</code> 。</p>\n\n<p>数组的子序列定义为:将数组中的若干个数字删除(可以删除 0 个数字),剩下的数字按照原本的顺序排布。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [10,2,-10,5,20], k = 2\n<strong>输出:</strong>37\n<strong>解释:</strong>子序列为 [10, 2, 5, 20] 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [-1,-2,-3], k = 1\n<strong>输出:</strong>-1\n<strong>解释:</strong>子序列必须是非空的,所以我们选择最大的数字。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>nums = [10,-2,-10,-5,20], k = 2\n<strong>输出:</strong>23\n<strong>解释:</strong>子序列为 [10, -2, -5, 20] 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= k <= nums.length <= 10^5</code></li>\n\t<li><code>-10^4 <= nums[i] <= 10^4</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 93,
|
||||
"likes": 97,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -167,7 +167,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.9K\", \"totalSubmission\": \"8.6K\", \"totalAcceptedRaw\": 3885, \"totalSubmissionRaw\": 8573, \"acRate\": \"45.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.1K\", \"totalSubmission\": \"9K\", \"totalAcceptedRaw\": 4079, \"totalSubmissionRaw\": 9002, \"acRate\": \"45.3%\"}",
|
||||
"hints": [
|
||||
"Use dynamic programming.",
|
||||
"Let dp[i] be the solution for the prefix of the array that ends at index i, if the element at index i is in the subsequence.",
|
||||
|
Reference in New Issue
Block a user