반응형
class Solution {
public String restoreString(String s, int[] indices) {
char[] chr = s.toCharArray();
StringBuffer sb = new StringBuffer();
for(int i=0; i < indices.length; i++){
for(int j =0; j < indices.length; j++){
if(i == indices[j]){
System.out.println(chr[j]);
sb.append(chr[j]);
}
}
}
return sb.toString();
}
}
반응형