내 답안
class Solution {
public String solution(String my_string, int[] index_list) {
String answer = "";
char str ='0';
for(int i=0; i<index_list.length; i++){
str = my_string.charAt(index_list[i]);
answer += Character.toString(str);
}
return answer;
}
}
Java
복사
다른 사람 풀이법
class Solution {
public String solution(String my_string, int[] index_list) {
StringBuilder sb = new StringBuilder();
for (int idx : index_list)
sb.append(my_string.charAt(idx));
return sb.toString();
}
}
Java
복사