Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ec1eea3

Browse files
chaerin-devprove-ability
authored andcommitted
Add 문자열-내림차순으로-배치하기.js
1 parent 115f3f7 commit ec1eea3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎level-1/문자열-내림차순으로-배치하기.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,15 @@ function solution(s) {
99
return 0
1010
}).join('')
1111
return answer;
12-
}
12+
}
13+
14+
//정답 2 - chaerin-dev
15+
function solution(s) {
16+
// 문자열 -> 배열 -> 정렬 -> 순서뒤집기 -> 문자열
17+
return s.split("").sort().reverse().join("");
18+
}
19+
20+
//정답3 - chaerin-dev
21+
function solution(s) {
22+
return s.split("").sort((a, b) => (a < b ? 1 : -1)).join("");
23+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /