mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 21:16:45 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组,返回它的某个 <strong>非空</strong> 子数组(连续元素)在执行一次可选的删除操作后,所能得到的最大元素总和。换句话说,你可以从原数组中选出一个子数组,并可以决定要不要从中删除一个元素(只能删一次哦),(删除后)子数组中至少应当有一个元素,然后该子数组(剩下)的元素总和是所有子数组之中最大的。</p>\n\n<p>注意,删除一个元素后,子数组 <strong>不能为空</strong>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,-2,0,3]\n<strong>输出:</strong>4\n<strong>解释:</strong>我们可以选出 [1, -2, 0, 3],然后删掉 -2,这样得到 [1, 0, 3],和最大。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,-2,-2,3]\n<strong>输出:</strong>3\n<strong>解释:</strong>我们直接选出 [3],这就是最大和。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [-1,-1,-1,-1]\n<strong>输出:</strong>-1\n<strong>解释:</strong>最后得到的子数组不能为空,所以我们不能选择 [-1] 并从中删去 -1 来得到 0。\n 我们应该直接选择 [-1],或者选择 [-1, -1] 再从中删去一个 -1。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n<meta charset=\"UTF-8\" />\n\n<ul>\n\t<li><code>1 <= arr.length <= 10<sup>5</sup></code></li>\n\t<li><code>-10<sup>4</sup> <= arr[i] <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 124,
|
||||
"likes": 127,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"21.6K\", \"totalAcceptedRaw\": 8688, \"totalSubmissionRaw\": 21550, \"acRate\": \"40.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9K\", \"totalSubmission\": \"22.1K\", \"totalAcceptedRaw\": 8972, \"totalSubmissionRaw\": 22107, \"acRate\": \"40.6%\"}",
|
||||
"hints": [
|
||||
"How to solve this problem if no deletions are allowed ?",
|
||||
"Try deleting each element and find the maximum subarray sum to both sides of that element.",
|
||||
|
Reference in New Issue
Block a user