class Solution {
public String solution(String my_string) {
String answer = "";
return answer;
}
}
해결법
방법 1
import java.util.Arrays;
class Solution {
public String solution(String my_string) {
my_string = my_string.toLowerCase();
char[] chArr = my_string.toCharArray();
Arrays.sort(chArr);
String answer = new String(chArr);
return answer;
}
}
방법 2
import java.util.*;
class Solution {
public String solution(String my_string) {
char[] chArr = my_string.toLowerCase().toCharArray();
Arrays.sort(chArr);
return new String(chArr);
}
}
방법 3
import java.util.*;
class Solution {
public String solution(String my_string) {
String answer = "";
String[] str = my_string.toLowerCase().split("");
Arrays.sort(str);
for (int i = 0; i < str.length; i++) {
answer += str[i];
}
return answer;
}
}
문자열 정렬하기 (2) Lv. 0