We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 399d2e4 commit a29af47Copy full SHA for a29af47
README.md
@@ -10,6 +10,8 @@ leetcode 测试
10
11
##### 包含的内容如下
12
13
+https://leetcode.cn/problems/queue-reconstruction-by-height/
14
+
15
https://leetcode.cn/problems/design-file-system/
16
17
https://leetcode.cn/problems/find-duplicate-file-in-system/
queue-reconstruction-by-height/index.ts
@@ -0,0 +1,15 @@
1
+export default function reconstructQueue(people: number[][]): number[][] {
2
+ const queue: number[][] = [];
3
+ people.sort((a, b) => {
4
+ if (b[0] !== a[0]) {
5
+ return b[0] - a[0];
6
+ } else {
7
+ return a[1] - b[1];
8
+ }
9
+ });
+ for (let i = 0; i < people.length; i++) {
+ queue.splice(people[i][1], 0, people[i]);
+ return queue;
+}
0 commit comments