Shuffle String

EasyArrayString

Solution

export function restoreString(s: string, indices: number[]): string {
  const n = indices.length;
  const answer: string[] = new Array(n).fill('');
  indices.forEach((index, i) => {
    answer[index] = s[i];
  });
  return answer.join('');
}