Move Each Character to Its Specified Destination Index
Company: Microsoft
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Other
### Problem
Character s[i] must move to output position indices[i]. The indices array is a permutation of all valid positions. Return the resulting string.
```cpp
class Solution {
public:
string restoreString(string s, vector<int>& indices);
};
```
### Examples
**Example 1:**
```text
Input: s = "abcd", indices = [2,0,3,1]
Output: "bdac"
Explanation: b goes to0,d to1,a to2,and c to3.
```
**Example 2:**
```text
Input: s = "xy", indices = [1,0]
Output: "yx"
Explanation: The two destination positions swap the characters.
```
### Constraints
- s.length equals indices.length equals n,with `1 <= n <= 100`.
- s contains only lowercase English letters.
- All indices are unique and lie in `[0,n-1]`.
### Contract considerations
Repeated letters remain separate source occurrences even when their characters are equal.
```hint Read the boundary condition
Keep the source-to-destination direction of the index mapping. Repeated letters still represent separate source occurrences.
```
### Boundary reminders
Repeated letters remain separate source occurrences even when their characters are equal.
Overview: Move Each Character to Its Specified Destination Index. Character s[i] must move to output position indices[i].