Skip to content

Commit a4db650

Browse files
authored
[JooKangsan] 2025.03.13 (#53)
* feat: 정렬 md 파일 추가 * 문자열 정렬하기 (1) / 기초 * 특이한 정렬 / 기초 * 진료 순서 정하기 / 기초 * 등수 매기기 / 기초 * 두 개 뽑아서 더하기 / 중급 * 삼총사 / 중급 * fix: 파일 명 변경
1 parent 1cbc9eb commit a4db650

File tree

7 files changed

+530
-0
lines changed

7 files changed

+530
-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+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function solution(numbers) {
2+
const result = new Set();
3+
4+
for(let i = 0; i < numbers.length; i++) {
5+
for(let j = i + 1; j < numbers.length; j++) {
6+
result.add(numbers[i] + numbers[j]);
7+
}
8+
}
9+
10+
return [...result].sort((a, b) => a - b);
11+
}

JooKangSan/[week9]Sort/Ranking.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 sum = score.map((el) => (el[0] + el[1]));
3+
let sortedSum = sum.slice().sort((a, b) => b - a);
4+
5+
return sum.map((el) => sortedSum.indexOf(el) + 1);
6+
}

0 commit comments

Comments
 (0)