본문 바로가기
python-algorithm

Leetcode 1528. Shuffle String

by 무적김두칠 2021. 7. 15.

1
2
3
4
5
6
7
8
9
class Solution:
    def restoreString(self, s: str, indices: List[int]) -> str:
        tmp=['0']*len(indices)
        for i in range(len(indices)):
            tmp[indices[i]]=s[i]
        ans=''
        for i in tmp:
            ans+=i
        return ans
cs
반응형

댓글