mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 09:21:40 +08:00
批量更新数据
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
<p>栈排序。 编写程序,对栈进行排序使最小元素位于栈顶。最多只能使用一个其他的临时栈存放数据,但不得将元素复制到别的数据结构(如数组)中。该栈支持如下操作:<code>push</code>、<code>pop</code>、<code>peek</code> 和 <code>isEmpty</code>。当栈为空时,<code>peek</code> 返回 -1。</p>
|
||||
|
||||
<p><strong>示例1:</strong></p>
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><strong> 输入</strong>:
|
||||
["SortedStack", "push", "push", "peek", "pop", "peek"]
|
||||
<pre>
|
||||
<strong> 输入</strong>:
|
||||
["SortedStack", "push", "push", "peek", "pop", "peek"]
|
||||
[[], [1], [2], [], [], []]
|
||||
<strong> 输出</strong>:
|
||||
[null,null,null,1,null,2]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例2:</strong></p>
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong> 输入</strong>:
|
||||
["SortedStack", "pop", "pop", "push", "pop", "isEmpty"]
|
||||
<pre>
|
||||
<strong> 输入</strong>:
|
||||
["SortedStack", "pop", "pop", "push", "pop", "isEmpty"]
|
||||
[[], [], [], [1], [], []]
|
||||
<strong> 输出</strong>:
|
||||
[null,null,null,null,null,true]
|
||||
</pre>
|
||||
|
||||
<p><strong>说明:</strong></p>
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ol>
|
||||
<li>栈中的元素数目在[0, 5000]范围内。</li>
|
||||
|
Reference in New Issue
Block a user