942. DI String Match
class Solution: def diStringMatch(self, S: str) -> List[int]: A=[i for i in range(len(S)+1)] res = A for index,s in enumerate(S): if s is 'I': A[index] =res[0] res = res[1:] if s is 'D': a = res[-1] res = res[0:-1] A[index] = a A[-1]=res[0] return A
1224ms,14.1M