We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5898301 commit 986ae4aCopy full SHA for 986ae4a
tkddbs587/Hash/Ranking.js
@@ -0,0 +1,10 @@
1
+function solution(score) {
2
+ // 1. score의 평균 점수를 구한다.
3
+ let avg = score.map((v) => (v[0] + v[1]) / 2);
4
+
5
+ // 2. avg를 내림차순으로 정렬한 배열 sort를 선언한다.
6
+ let sorted = avg.slice().sort((a, b) => b - a);
7
8
+ // 3. avg의 요소와 동일한 sorted 배열의 index 값에 1을 더한다.
9
+ return avg.map((v) => sorted.indexOf(v) + 1);
10
+}
0 commit comments