프로그래머스 문자열 내림차순으로 배치하기
-
Level1) 문자열 내림차순으로 배치하기PS/programmers 2020. 9. 8. 17:06
import java.util.Arrays; import java.util.Collections; class Solution { public static String solution(String s) { Character[] answer = new Character[s.length()]; String answer1 = ""; for (int i = 0; i < answer.length; i++) { answer[i] = s.charAt(i); } Arrays.sort(answer, Collections.reverseOrder()); for (int i = 0; i < answer.length; i++) { answer1 += Character.toString(answer[i]); } return answ..