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 20a6556 commit d3ebaa6Copy full SHA for d3ebaa6
bona1122/[week9]Sort/Largest_number.js
@@ -0,0 +1,12 @@
1
+// https://school.programmers.co.kr/learn/courses/30/lessons/42746
2
+
3
+function solution(numbers) {
4
+ const convertString = numbers.map((number) => number.toString())
5
+ const sorted = convertString.sort((a, b) => {
6
+ const AB = Number(a + b)
7
+ const BA = Number(b + a)
8
+ return BA - AB
9
+ })
10
+ const result = sorted.join("")
11
+ return result[0] === "0" ? "0" : result
12
+}
0 commit comments