mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-12 02:41:42 +08:00
更新国内版力扣题目描述变更
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
<p>Describe how you could use a single array to implement three stacks.</p>
|
||||
|
||||
<p>You should implement <code>push(stackNum, value)</code>、<code>pop(stackNum)</code>、<code>isEmpty(stackNum)</code>、<code>peek(stackNum)</code> methods. <code>stackNum<font face="sans-serif, Arial, Verdana, Trebuchet MS"> </font></code><font face="sans-serif, Arial, Verdana, Trebuchet MS">is the index of the stack. </font><code>value</code> is the value that pushed to the stack.</p>
|
||||
|
||||
<p>The constructor requires a <code>stackSize</code> parameter, which represents the size of each stack.</p>
|
||||
|
||||
<p><strong>Example1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong> Input</strong>:
|
||||
["TripleInOne", "push", "push", "pop", "pop", "pop", "isEmpty"]
|
||||
[[1], [0, 1], [0, 2], [0], [0], [0], [0]]
|
||||
<strong> Output</strong>:
|
||||
[null, null, null, 1, -1, -1, true]
|
||||
<b>Explanation</b>: When the stack is empty, `pop, peek` return -1. When the stack is full, `push` does nothing.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong> Input</strong>:
|
||||
["TripleInOne", "push", "push", "push", "pop", "pop", "pop", "peek"]
|
||||
[[2], [0, 1], [0, 2], [0, 3], [0], [0], [0], [0]]
|
||||
<strong> Output</strong>:
|
||||
[null, null, null, null, 2, 1, -1, -1]
|
||||
</pre>
|
||||
<p>Describe how you could use a single array to implement three stacks.</p>
|
||||
|
||||
|
||||
|
||||
<p>You should implement <code>push(stackNum, value)</code>、<code>pop(stackNum)</code>、<code>isEmpty(stackNum)</code>、<code>peek(stackNum)</code> methods. <code>stackNum<font face="sans-serif, Arial, Verdana, Trebuchet MS"> </font></code><font face="sans-serif, Arial, Verdana, Trebuchet MS">is the index of the stack. </font><code>value</code> is the value that pushed to the stack.</p>
|
||||
|
||||
|
||||
|
||||
<p>The constructor requires a <code>stackSize</code> parameter, which represents the size of each stack.</p>
|
||||
|
||||
|
||||
|
||||
<p><strong>Example1:</strong></p>
|
||||
|
||||
|
||||
|
||||
<pre>
|
||||
|
||||
<strong> Input</strong>:
|
||||
|
||||
["TripleInOne", "push", "push", "pop", "pop", "pop", "isEmpty"]
|
||||
|
||||
[[1], [0, 1], [0, 2], [0], [0], [0], [0]]
|
||||
|
||||
<strong> Output</strong>:
|
||||
|
||||
|
Reference in New Issue
Block a user