LeetCode 1528.重新排列字符串

时间复杂度O(n)

class Solution {
public String restoreString(String s, int[] indices) {
char[] chars = s.toCharArray();
for (int i = 0; i < indices.length; i++) {
chars[indices[i]] = s.charAt(i);
}
return new String(chars);
}
}

//runtime:1 ms
//memory:38.5 MB