1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 05:26:46 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>有一个自行车手打算进行一场公路骑行,这条路线总共由 <code>n + 1</code> 个不同海拔的点组成。自行车手从海拔为 <code>0</code> 的点 <code>0</code> 开始骑行。</p>\n\n<p>给你一个长度为 <code>n</code> 的整数数组 <code>gain</code> ,其中 <code>gain[i]</code> 是点 <code>i</code> 和点 <code>i + 1</code> 的 <strong>净海拔高度差</strong><code>0 <= i < n</code>)。请你返回 <strong>最高点的海拔</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<b>输入:</b>gain = [-5,1,5,0,-7]\n<b>输出:</b>1\n<b>解释:</b>海拔高度依次为 [0,-5,-4,1,1,-6] 。最高海拔为 1 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<b>输入:</b>gain = [-4,-3,-2,-1,4,3,2]\n<b>输出:</b>0\n<b>解释:</b>海拔高度依次为 [0,-4,-7,-9,-10,-6,-3,-1] 。最高海拔为 0 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == gain.length</code></li>\n\t<li><code>1 <= n <= 100</code></li>\n\t<li><code>-100 <= gain[i] <= 100</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 16,
"likes": 17,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"14.9K\", \"totalSubmission\": \"18.9K\", \"totalAcceptedRaw\": 14888, \"totalSubmissionRaw\": 18935, \"acRate\": \"78.6%\"}",
"stats": "{\"totalAccepted\": \"15.5K\", \"totalSubmission\": \"19.7K\", \"totalAcceptedRaw\": 15455, \"totalSubmissionRaw\": 19665, \"acRate\": \"78.6%\"}",
"hints": [
"Let's note that the altitude of an element is the sum of gains of all the elements behind it",
"Getting the altitudes can be done by getting the prefix sum array of the given array"