Problem Solving/Programmers
[Level 2] 가장 큰 수
kmkunk
2022. 3. 31. 16:36
import java.util.*;
class Solution {
public String solution(int[] numbers) {
String answer = "";
String[] arr = new String[numbers.length];
for(int i=0; i<arr.length; i++) { arr[i] = String.valueOf(numbers[i]); }
Arrays.sort(arr, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return (s2+s1).compareTo(s1+s2);
}
});
for(String s : arr) { answer += s; }
return answer;
}
}