mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>假设有打乱顺序的一群人站成一个队列,数组 <code>people</code> 表示队列中一些人的属性(不一定按顺序)。每个 <code>people[i] = [h<sub>i</sub>, k<sub>i</sub>]</code> 表示第 <code>i</code> 个人的身高为 <code>h<sub>i</sub></code> ,前面 <strong>正好</strong> 有 <code>k<sub>i</sub></code><sub> </sub>个身高大于或等于 <code>h<sub>i</sub></code> 的人。</p>\n\n<p>请你重新构造并返回输入数组 <code>people</code> 所表示的队列。返回的队列应该格式化为数组 <code>queue</code> ,其中 <code>queue[j] = [h<sub>j</sub>, k<sub>j</sub>]</code> 是队列中第 <code>j</code> 个人的属性(<code>queue[0]</code> 是排在队列前面的人)。</p>\n\n<p> </p>\n\n<ul>\n</ul>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>people = [[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]]\n<strong>输出:</strong>[[5,0],[7,0],[5,2],[6,1],[4,4],[7,1]]\n<strong>解释:</strong>\n编号为 0 的人身高为 5 ,没有身高更高或者相同的人排在他前面。\n编号为 1 的人身高为 7 ,没有身高更高或者相同的人排在他前面。\n编号为 2 的人身高为 5 ,有 2 个身高更高或者相同的人排在他前面,即编号为 0 和 1 的人。\n编号为 3 的人身高为 6 ,有 1 个身高更高或者相同的人排在他前面,即编号为 1 的人。\n编号为 4 的人身高为 4 ,有 4 个身高更高或者相同的人排在他前面,即编号为 0、1、2、3 的人。\n编号为 5 的人身高为 7 ,有 1 个身高更高或者相同的人排在他前面,即编号为 1 的人。\n因此 [[5,0],[7,0],[5,2],[6,1],[4,4],[7,1]] 是重新构造后的队列。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>people = [[6,0],[5,0],[4,0],[3,2],[2,2],[1,4]]\n<strong>输出:</strong>[[4,0],[5,0],[2,2],[3,2],[1,4],[6,0]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= people.length <= 2000</code></li>\n\t<li><code>0 <= h<sub>i</sub> <= 10<sup>6</sup></code></li>\n\t<li><code>0 <= k<sub>i</sub> < people.length</code></li>\n\t<li>题目数据确保队列可以被重建</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 1184,
|
||||
"likes": 1222,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Count of Smaller Numbers After Self\", \"titleSlug\": \"count-of-smaller-numbers-after-self\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u8ba1\\u7b97\\u53f3\\u4fa7\\u5c0f\\u4e8e\\u5f53\\u524d\\u5143\\u7d20\\u7684\\u4e2a\\u6570\"}]",
|
||||
@@ -25,6 +25,18 @@
|
||||
"translatedName": "贪心",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Binary Indexed Tree",
|
||||
"slug": "binary-indexed-tree",
|
||||
"translatedName": "树状数组",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Segment Tree",
|
||||
"slug": "segment-tree",
|
||||
"translatedName": "线段树",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Array",
|
||||
"slug": "array",
|
||||
@@ -149,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"151.3K\", \"totalSubmission\": \"203K\", \"totalAcceptedRaw\": 151316, \"totalSubmissionRaw\": 202952, \"acRate\": \"74.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"159.4K\", \"totalSubmission\": \"213.1K\", \"totalAcceptedRaw\": 159373, \"totalSubmissionRaw\": 213096, \"acRate\": \"74.8%\"}",
|
||||
"hints": [
|
||||
"What can you say about the position of the shortest person? </br>\r\nIf the position of the shortest person is <i>i</i>, how many people would be in front of the shortest person?",
|
||||
"Once you fix the position of the shortest person, what can you say about the position of the second shortest person?"
|
||||
|
Reference in New Issue
Block a user