File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,25 @@ class Solution:
226
226
227
227
Go:
228
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
+ })
229
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
+ ```
230
248
231
249
232
250
-----------------------
Original file line number Diff line number Diff line change @@ -175,7 +175,24 @@ class Solution:
175
175
176
176
Go:
177
177
178
+ Javascript:
179
+ ``` Javascript
180
+ var findMinArrowShots = function (points ) {
181
+ points .sort ((a , b ) => {
182
+ return a[0 ] - b[0 ]
183
+ })
184
+ let result = 1
185
+ for (let i = 1 ; i < points .length ; i++ ) {
186
+ if (points[i][0 ] > points[i - 1 ][1 ]) {
187
+ result++
188
+ } else {
189
+ points[i][1 ] = Math .min (points[i - 1 ][1 ], points[i][1 ])
190
+ }
191
+ }
178
192
193
+ return result
194
+ };
195
+ ```
179
196
180
197
181
198
-----------------------
You can’t perform that action at this time.
0 commit comments