mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个正整数数组 <code>arr</code> ,请你计算所有可能的奇数长度子数组的和。</p>\n\n<p><strong>子数组</strong> 定义为原数组中的一个连续子序列。</p>\n\n<p>请你返回 <code>arr</code> 中 <strong>所有奇数长度子数组的和</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>arr = [1,4,2,5,3]\n<strong>输出:</strong>58\n<strong>解释:</strong>所有奇数长度子数组和它们的和为:\n[1] = 1\n[4] = 4\n[2] = 2\n[5] = 5\n[3] = 3\n[1,4,2] = 7\n[4,2,5] = 11\n[2,5,3] = 10\n[1,4,2,5,3] = 15\n我们将所有值求和得到 1 + 4 + 2 + 5 + 3 + 7 + 11 + 10 + 15 = 58</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>arr = [1,2]\n<strong>输出:</strong>3\n<strong>解释:</strong>总共只有 2 个长度为奇数的子数组,[1] 和 [2]。它们的和为 3 。</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>arr = [10,11,12]\n<strong>输出:</strong>66\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= arr.length <= 100</code></li>\n\t<li><code>1 <= arr[i] <= 1000</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 167,
|
||||
"likes": 174,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"49.9K\", \"totalSubmission\": \"59.4K\", \"totalAcceptedRaw\": 49855, \"totalSubmissionRaw\": 59442, \"acRate\": \"83.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"51.4K\", \"totalSubmission\": \"61.3K\", \"totalAcceptedRaw\": 51432, \"totalSubmissionRaw\": 61297, \"acRate\": \"83.9%\"}",
|
||||
"hints": [
|
||||
"You can brute force – try every (i,j) pair, and if the length is odd, go through and add the sum to the answer."
|
||||
],
|
||||
|
Reference in New Issue
Block a user