Leetcode 1651 Solution
This article provides solution to leetcode question 1651 (shuffle-string)
Access this page by simply typing in "lcs 1651" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/shuffle-string
Solution
class Solution:
def restoreString(self, s: str, indices: List[int]) -> str:
n = len(s)
ans = [0] * n
for ch, index in zip(s, indices):
ans[index] = ch
return "".join(ans)