1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +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>给你一个整数数组&nbsp;<code>prices</code>&nbsp;,表示一支股票的历史每日股价,其中&nbsp;<code>prices[i]</code>&nbsp;是这支股票第&nbsp;<code>i</code>&nbsp;天的价格。</p>\n\n<p>一个 <strong>平滑下降的阶段</strong>&nbsp;定义为:对于&nbsp;<strong>连续一天或者多天</strong>&nbsp;,每日股价都比 <strong>前一日股价恰好少 </strong><code>1</code>&nbsp;,这个阶段第一天的股价没有限制。</p>\n\n<p>请你返回 <strong>平滑下降阶段</strong>&nbsp;的数目。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>prices = [3,2,1,4]\n<b>输出:</b>7\n<b>解释:</b>总共有 7 个平滑下降阶段:\n[3], [2], [1], [4], [3,2], [2,1] 和 [3,2,1]\n注意仅一天按照定义也是平滑下降阶段。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>prices = [8,6,7,7]\n<b>输出:</b>4\n<b>解释:</b>总共有 4 个连续平滑下降阶段:[8], [6], [7] 和 [7]\n由于 8 - 6 ≠ 1 ,所以 [8,6] 不是平滑下降阶段。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><b>输入:</b>prices = [1]\n<b>输出:</b>1\n<b>解释:</b>总共有 1 个平滑下降阶段:[1]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= prices.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= prices[i] &lt;= 10<sup>5</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 13,
"likes": 14,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.9K\", \"totalSubmission\": \"13.4K\", \"totalAcceptedRaw\": 6884, \"totalSubmissionRaw\": 13444, \"acRate\": \"51.2%\"}",
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 7158, \"totalSubmissionRaw\": 13877, \"acRate\": \"51.6%\"}",
"hints": [
"Any array is a series of adjacent longest possible smooth descent periods. For example, [5,3,2,1,7,6] is [5] + [3,2,1] + [7,6].",
"Think of a 2-pointer approach to traverse the array and find each longest possible period.",