Skip to content

Commit 3f22869

Browse files
committed
Athlete_who_did_not_finish / 중급
1 parent cf66aeb commit 3f22869

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function solution(participant, completion) {
2+
// 두 배열 sort로 정렬
3+
participant.sort();
4+
completion.sort();
5+
6+
// 참가자 배열 길이만큼 순회
7+
for (let i = 0; i < participant.length; i++) {
8+
// 참가자 배열에 [i]와 완주자 배열의[i]가 다르면 탈락한 참가자로 판단
9+
if (participant[i] !== completion[i]) {
10+
return participant[i];
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)