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 e470235 commit 7beb711Copy full SHA for 7beb711
problems/0406.根据身高重建队列.md
@@ -226,7 +226,25 @@ class Solution:
226
227
Go:
228
229
+Javascript:
230
+```Javascript
231
+var reconstructQueue = function(people) {
232
+ let queue = []
233
+ people.sort((a, b ) => {
234
+ if(b[0] !== a[0]) {
235
+ return b[0] - a[0]
236
+ } else {
237
+ return a[1] - b[1]
238
+ }
239
+
240
+ })
241
242
+ for(let i = 0; i < people.length; i++) {
243
+ queue.splice(people[i][1], 0, people[i])
244
245
+ return queue
246
+};
247
+```
248
249
250
-----------------------
0 commit comments