Skip to content

Commit 3d83222

Browse files
committed
진료 순서 정하기 / 기초
1 parent 382871a commit 3d83222

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function solution(emergency) {
2+
var answer = [];
3+
const indexed = emergency.map((value, index) => ({ value, index }));
4+
indexed.sort((a, b) => b.value - a.value);
5+
for (let i = 0; i < indexed.length; i++) {
6+
answer[indexed[i].index] = i + 1;
7+
}
8+
return answer ;
9+
}

0 commit comments

Comments
 (0)