1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-03 06:22:54 +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>arr</code>,如果它是有效的山脉数组就返回&nbsp;<code>true</code>,否则返回 <code>false</code>。</p>\n\n<p>让我们回顾一下,如果 <code>arr</code>&nbsp;满足下述条件,那么它是一个山脉数组:</p>\n\n<ul>\n\t<li><code>arr.length &gt;= 3</code></li>\n\t<li>在&nbsp;<code>0 &lt; i&nbsp;&lt; arr.length - 1</code>&nbsp;条件下,存在&nbsp;<code>i</code>&nbsp;使得:\n\t<ul>\n\t\t<li><code>arr[0] &lt; arr[1] &lt; ... arr[i-1] &lt; arr[i] </code></li>\n\t\t<li><code>arr[i] &gt; arr[i+1] &gt; ... &gt; arr[arr.length - 1]</code></li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2019/10/20/hint_valid_mountain_array.png\" style=\"height: 316px; width: 500px;\" /></p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [2,1]\n<strong>输出:</strong>false\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [3,5,5]\n<strong>输出:</strong>false\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [0,3,2,1]\n<strong>输出:</strong>true</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= arr.length &lt;= 10<sup>4</sup></code></li>\n\t<li><code>0 &lt;= arr[i] &lt;= 10<sup>4</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 171,
"likes": 173,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -137,7 +137,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"65.9K\", \"totalSubmission\": \"167.6K\", \"totalAcceptedRaw\": 65889, \"totalSubmissionRaw\": 167596, \"acRate\": \"39.3%\"}",
"stats": "{\"totalAccepted\": \"66.6K\", \"totalSubmission\": \"169.4K\", \"totalAcceptedRaw\": 66613, \"totalSubmissionRaw\": 169409, \"acRate\": \"39.3%\"}",
"hints": [
"It's very easy to keep track of a monotonically increasing or decreasing ordering of elements. You just need to be able to determine the start of the valley in the mountain and from that point onwards, it should be a valley i.e. no mini-hills after that. Use this information in regards to the values in the array and you will be able to come up with a straightforward solution."
],