Your question is Rearrange Letters by Positions. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An OnStar vehicle service receives a message whose characters arrive out of order. You are given a string letters and an integer array positions, where positions[i] is the destination index for letters[i]. Rearrange the characters into their intended order and return the resulting string.
letters: a string of length N.positions: an integer array of length N.positions is a permutation of every integer from 0 through N - 1.letters[i] must be placed at index positions[i] in the output.def restore_message(letters, positions):