mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>栈排序。 编写程序,对栈进行排序使最小元素位于栈顶。最多只能使用一个其他的临时栈存放数据,但不得将元素复制到别的数据结构(如数组)中。该栈支持如下操作:<code>push</code>、<code>pop</code>、<code>peek</code> 和 <code>isEmpty</code>。当栈为空时,<code>peek</code> 返回 -1。</p>\n\n<p><strong>示例1:</strong></p>\n\n<pre><strong> 输入</strong>:\n["SortedStack", "push", "push", "peek", "pop", "peek"]\n[[], [1], [2], [], [], []]\n<strong> 输出</strong>:\n[null,null,null,1,null,2]\n</pre>\n\n<p><strong>示例2:</strong></p>\n\n<pre><strong> 输入</strong>: \n["SortedStack", "pop", "pop", "push", "pop", "isEmpty"]\n[[], [], [], [1], [], []]\n<strong> 输出</strong>:\n[null,null,null,null,null,true]\n</pre>\n\n<p><strong>说明:</strong></p>\n\n<ol>\n\t<li>栈中的元素数目在[0, 5000]范围内。</li>\n</ol>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 61,
|
||||
"likes": 67,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"18.9K\", \"totalSubmission\": \"35.1K\", \"totalAcceptedRaw\": 18928, \"totalSubmissionRaw\": 35143, \"acRate\": \"53.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"19.8K\", \"totalSubmission\": \"36.7K\", \"totalAcceptedRaw\": 19766, \"totalSubmissionRaw\": 36684, \"acRate\": \"53.9%\"}",
|
||||
"hints": [
|
||||
"排序数组的一种方法是遍历数组,并将每个元素按排序顺序插入到一个新数组中。你可以用一个栈实现吗?",
|
||||
"假设二级栈已排序。你能按顺序插入元素吗?你可能需要一些额外的存储空间。你可以使用什么额外的存储?",
|
||||
|
Reference in New Issue
Block a user