1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-03 06:22:54 +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>在考场里,一排有&nbsp;<code>N</code>&nbsp;个座位,分别编号为&nbsp;<code>0, 1, 2, ..., N-1</code>&nbsp;。</p>\n\n<p>当学生进入考场后,他必须坐在能够使他与离他最近的人之间的距离达到最大化的座位上。如果有多个这样的座位,他会坐在编号最小的座位上。(另外,如果考场里没有人,那么学生就坐在 0 号座位上。)</p>\n\n<p>返回&nbsp;<code>ExamRoom(int N)</code>&nbsp;类,它有两个公开的函数:其中,函数&nbsp;<code>ExamRoom.seat()</code>&nbsp;会返回一个&nbsp;<code>int</code>&nbsp;(整型数据),代表学生坐的位置;函数&nbsp;<code>ExamRoom.leave(int p)</code>&nbsp;代表坐在座位 <code>p</code> 上的学生现在离开了考场。每次调用&nbsp;<code>ExamRoom.leave(p)</code>&nbsp;时都保证有学生坐在座位&nbsp;<code>p</code>&nbsp;上。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例:</strong></p>\n\n<pre><strong>输入:</strong>[&quot;ExamRoom&quot;,&quot;seat&quot;,&quot;seat&quot;,&quot;seat&quot;,&quot;seat&quot;,&quot;leave&quot;,&quot;seat&quot;], [[10],[],[],[],[],[4],[]]\n<strong>输出:</strong>[null,0,9,4,2,null,5]\n<strong>解释:</strong>\nExamRoom(10) -&gt; null\nseat() -&gt; 0没有人在考场里那么学生坐在 0 号座位上。\nseat() -&gt; 9学生最后坐在 9 号座位上。\nseat() -&gt; 4学生最后坐在 4 号座位上。\nseat() -&gt; 2学生最后坐在 2 号座位上。\nleave(4) -&gt; null\nseat() -&gt; 5学生最后坐在 5 号座位上。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ol>\n\t<li><code>1 &lt;= N &lt;= 10^9</code></li>\n\t<li>在所有的测试样例中&nbsp;<code>ExamRoom.seat()</code>&nbsp;和&nbsp;<code>ExamRoom.leave()</code>&nbsp;最多被调用&nbsp;<code>10^4</code>&nbsp;次。</li>\n\t<li>保证在调用&nbsp;<code>ExamRoom.leave(p)</code>&nbsp;时有学生正坐在座位 <code>p</code> 上。</li>\n</ol>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 111,
"likes": 115,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Maximize Distance to Closest Person\", \"titleSlug\": \"maximize-distance-to-closest-person\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u5230\\u6700\\u8fd1\\u7684\\u4eba\\u7684\\u6700\\u5927\\u8ddd\\u79bb\"}]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.5K\", \"totalSubmission\": \"15.8K\", \"totalAcceptedRaw\": 6474, \"totalSubmissionRaw\": 15843, \"acRate\": \"40.9%\"}",
"stats": "{\"totalAccepted\": \"6.8K\", \"totalSubmission\": \"16.7K\", \"totalAcceptedRaw\": 6850, \"totalSubmissionRaw\": 16688, \"acRate\": \"41.0%\"}",
"hints": [],
"solution": null,
"status": null,