1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>三合一。描述如何只用一个数组来实现三个栈。</p>\n\n<p>你应该实现<code>push(stackNum, value)</code>、<code>pop(stackNum)</code>、<code>isEmpty(stackNum)</code>、<code>peek(stackNum)</code>方法。<code>stackNum</code>表示栈下标,<code>value</code>表示压入的值。</p>\n\n<p>构造函数会传入一个<code>stackSize</code>参数,代表每个栈的大小。</p>\n\n<p><strong>示例1:</strong></p>\n\n<pre>\n<strong> 输入</strong>\n[\"TripleInOne\", \"push\", \"push\", \"pop\", \"pop\", \"pop\", \"isEmpty\"]\n[[1], [0, 1], [0, 2], [0], [0], [0], [0]]\n<strong> 输出</strong>\n[null, null, null, 1, -1, -1, true]\n<strong>说明</strong>:当栈为空时`pop, peek`返回-1当栈满时`push`不压入元素。\n</pre>\n\n<p><strong>示例2:</strong></p>\n\n<pre>\n<strong> 输入</strong>\n[\"TripleInOne\", \"push\", \"push\", \"push\", \"pop\", \"pop\", \"pop\", \"peek\"]\n[[2], [0, 1], [0, 2], [0, 3], [0], [0], [0], [0]]\n<strong> 输出</strong>\n[null, null, null, null, 2, 1, -1, -1]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 &lt;= stackNum &lt;= 2</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 47,
"likes": 48,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"14.6K\", \"totalSubmission\": \"27.4K\", \"totalAcceptedRaw\": 14571, \"totalSubmissionRaw\": 27421, \"acRate\": \"53.1%\"}",
"stats": "{\"totalAccepted\": \"14.6K\", \"totalSubmission\": \"27.5K\", \"totalAcceptedRaw\": 14610, \"totalSubmissionRaw\": 27517, \"acRate\": \"53.1%\"}",
"hints": [
"栈只是一个数据结构,其中最近添加的元素首先被删除。你能用一个数组来模拟单个栈吗?请记住,有很多可能的解法且每个解法都有其利弊。",
"我们可以通过将数组的前三分之一分配到第一个栈、第二个三分之一分配到第二个栈、最后的第三个三分之一分配到第三个栈,来模拟数组中的三个栈。然而,实际上某个栈可能比其他的大得多。能更灵活地分配吗?",