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 7350eb5 commit 1c4fe1aCopy full SHA for 1c4fe1a
level-4/무지의-먹방-라이브.js
@@ -8,11 +8,11 @@ function solution(food_times, k) {
8
}
9
10
// stack으로 풀기
11
- const stack = food_times.map((time, i) => [time, i + 1]).sort((a,b) => b[0] - a[0])
+ const stack = food_times.map((time, i) => [time, i + 1]).sort(([timeA],[timeB]) => timeB - timeA)
12
13
let prev = 0
14
while (stack.length > 0 && k >= 0) {
15
- const time = stack[stack.length - 1][0]
+ const [time] = stack[stack.length - 1]
16
const acc = (time - prev) * stack.length
17
if (k < acc) {
18
break
@@ -24,7 +24,7 @@ function solution(food_times, k) {
24
25
const result = stack
26
.reverse()
27
- .map((item) => item[1])
28
- .sort((a,b) => a - b)
+ .map(([_,order]) => order)
+ .sort((orderA,orderB) => orderA - orderB)
29
return result[k % result.length]
30
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments