1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 14:12:17 +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>设计实现双端队列。</p>\n\n<p>实现 <code>MyCircularDeque</code> 类:</p>\n\n<ul>\n\t<li><code>MyCircularDeque(int k)</code>&nbsp;:构造函数,双端队列最大为 <code>k</code> 。</li>\n\t<li><code>boolean insertFront()</code>:将一个元素添加到双端队列头部。 如果操作成功返回 <code>true</code>&nbsp;,否则返回 <code>false</code> 。</li>\n\t<li><code>boolean insertLast()</code>&nbsp;:将一个元素添加到双端队列尾部。如果操作成功返回 <code>true</code>&nbsp;,否则返回 <code>false</code> 。</li>\n\t<li><code>boolean deleteFront()</code>&nbsp;:从双端队列头部删除一个元素。 如果操作成功返回 <code>true</code>&nbsp;,否则返回 <code>false</code> 。</li>\n\t<li><code>boolean deleteLast()</code>&nbsp;:从双端队列尾部删除一个元素。如果操作成功返回 <code>true</code>&nbsp;,否则返回 <code>false</code> 。</li>\n\t<li><code>int getFront()</code>&nbsp;):从双端队列头部获得一个元素。如果双端队列为空,返回 <code>-1</code>&nbsp;。</li>\n\t<li><code>int getRear()</code>&nbsp;:获得双端队列的最后一个元素。&nbsp;如果双端队列为空,返回 <code>-1</code> 。</li>\n\t<li><code>boolean isEmpty()</code>&nbsp;:若双端队列为空,则返回&nbsp;<code>true</code>&nbsp;,否则返回 <code>false</code> &nbsp;。</li>\n\t<li><code>boolean isFull()</code>&nbsp;:若双端队列满了,则返回&nbsp;<code>true</code>&nbsp;,否则返回 <code>false</code> 。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入</strong>\n[\"MyCircularDeque\", \"insertLast\", \"insertLast\", \"insertFront\", \"insertFront\", \"getRear\", \"isFull\", \"deleteLast\", \"insertFront\", \"getFront\"]\n[[3], [1], [2], [3], [4], [], [], [], [4], []]\n<strong>输出</strong>\n[null, true, true, true, false, 2, true, true, true, 4]\n\n<strong>解释</strong>\nMyCircularDeque circularDeque = new MycircularDeque(3); // 设置容量大小为3\ncircularDeque.insertLast(1);\t\t\t // 返回 true\ncircularDeque.insertLast(2);\t\t\t // 返回 true\ncircularDeque.insertFront(3);\t\t\t // 返回 true\ncircularDeque.insertFront(4);\t\t\t // 已经满了,返回 false\ncircularDeque.getRear(); \t\t\t\t// 返回 2\ncircularDeque.isFull();\t\t\t\t // 返回 true\ncircularDeque.deleteLast();\t\t\t // 返回 true\ncircularDeque.insertFront(4);\t\t\t // 返回 true\ncircularDeque.getFront();\t\t\t\t// 返回 4\n&nbsp;</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= k &lt;= 1000</code></li>\n\t<li><code>0 &lt;= value &lt;= 1000</code></li>\n\t<li><code>insertFront</code>,&nbsp;<code>insertLast</code>,&nbsp;<code>deleteFront</code>,&nbsp;<code>deleteLast</code>,&nbsp;<code>getFront</code>,&nbsp;<code>getRear</code>,&nbsp;<code>isEmpty</code>,&nbsp;<code>isFull</code>&nbsp; 调用次数不大于&nbsp;<code>2000</code>&nbsp;次</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 113,
"likes": 116,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Design Circular Queue\", \"titleSlug\": \"design-circular-queue\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8bbe\\u8ba1\\u5faa\\u73af\\u961f\\u5217\"}]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"25.8K\", \"totalSubmission\": \"48.6K\", \"totalAcceptedRaw\": 25762, \"totalSubmissionRaw\": 48610, \"acRate\": \"53.0%\"}",
"stats": "{\"totalAccepted\": \"26.6K\", \"totalSubmission\": \"50.4K\", \"totalAcceptedRaw\": 26632, \"totalSubmissionRaw\": 50364, \"acRate\": \"52.9%\"}",
"hints": [],
"solution": null,
"status": null,