class Solution(object):
def restoreString(self, s, indices):
"""
:type s: str
:type indices: List[int]
:rtype: str
"""
arr = [0 for i in range(len(s))]
j = 0
for val in indices:
arr[val] = s[j]
j += 1
s2 = ''
for val in arr:
s2 += val
return s2
1528. 重新排列字符串(LeetCode-力扣-Python)
最新推荐文章于 2024-07-25 19:34:38 发布