Skip to content

Commit 8f38987

Browse files
committed
rank order / 湲곗�
1 parent f9ab318 commit 8f38987

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

JustDevRae/Hash/rank_order.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function solution(score) {
2+
const averages = score.map(([english, math]) => (english + math) / 2);
3+
const sortedAverages = [...averages].sort((a, b) => b - a);
4+
5+
return averages.map((avg) => sortedAverages.indexOf(avg) + 1);
6+
}

0 commit comments

Comments
 (0)