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 ac22d56 commit e55c16dCopy full SHA for e55c16d
Moonjonghoo/hash/등수 매기기.js
@@ -0,0 +1,10 @@
1
+function solution(score) {
2
+ // 각 학생의 평균 점수 계산
3
+ const averages = score.map(([eng, math]) => (eng + math) / 2);
4
+
5
+ // 평균 점수를 내림차순으로 정렬하여 등수 매기기
6
+ const sorted = [...averages].sort((a, b) => b - a);
7
8
+ // 원래 평균 점수 배열의 각 값이 정렬된 배열에서 몇 번째 순위인지 계산
9
+ return averages.map((avg) => sorted.indexOf(avg) + 1);
10
+}
0 commit comments