文章作者:Tyan 博客:noahsnail.com | CSDN | 简书
1. Description
2. Solution
**解析:**Version 1,根据要求,按顺序将字母填到对应位置即可。
- Version 1
class Solution:
def restoreString(self, s: str, indices: List[int]) -> str:
res = ['0'] * len(s)
for index, pos in enumerate(indices):
res[pos] = s[index]
return ''.join(res)
Reference
- https://leetcode.com/problems/shuffle-string/