mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> ,请你找到 <strong>最左边</strong> 的中间位置 <code>middleIndex</code> (也就是所有可能中间位置下标最小的一个)。</p>\n\n<p>中间位置 <code>middleIndex</code> 是满足 <code>nums[0] + nums[1] + ... + nums[middleIndex-1] == nums[middleIndex+1] + nums[middleIndex+2] + ... + nums[nums.length-1]</code> 的数组下标。</p>\n\n<p>如果 <code>middleIndex == 0</code> ,左边部分的和定义为 <code>0</code> 。类似的,如果 <code>middleIndex == nums.length - 1</code> ,右边部分的和定义为 <code>0</code> 。</p>\n\n<p>请你返回满足上述条件 <strong>最左边</strong> 的<em> </em><code>middleIndex</code> ,如果不存在这样的中间位置,请你返回 <code>-1</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [2,3,-1,<em><strong>8</strong></em>,4]\n<b>输出:</b>3\n<strong>解释:</strong>\n下标 3 之前的数字和为:2 + 3 + -1 = 4\n下标 3 之后的数字和为:4 = 4\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [1,-1,<em><strong>4</strong></em>]\n<b>输出:</b>2\n<strong>解释:</strong>\n下标 2 之前的数字和为:1 + -1 = 0\n下标 2 之后的数字和为:0\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [2,5]\n<b>输出:</b>-1\n<b>解释:</b>\n不存在符合要求的 middleIndex 。\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [<em><strong>1</strong></em>]\n<b>输出:</b>0\n<strong>解释:</strong>\n下标 0 之前的数字和为:0\n下标 0 之后的数字和为:0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 100</code></li>\n\t<li><code>-1000 <= nums[i] <= 1000</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>注意:</strong>本题与主站 724 题相同:<a href=\"https://leetcode-cn.com/problems/find-pivot-index/\" target=\"_blank\">https://leetcode-cn.com/problems/find-pivot-index/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 17,
|
||||
"likes": 18,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"14K\", \"totalAcceptedRaw\": 9180, \"totalSubmissionRaw\": 13995, \"acRate\": \"65.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"15.5K\", \"totalAcceptedRaw\": 10137, \"totalSubmissionRaw\": 15534, \"acRate\": \"65.3%\"}",
|
||||
"hints": [
|
||||
"Could we go from left to right and check to see if an index is a middle index?",
|
||||
"Do we need to sum every number to the left and right of an index each time?",
|
||||
|
Reference in New Issue
Block a user