classSolution:defreverseString(self,s: List[str]) ->None:""" Do not return anything, modify s in-place instead. """ left =0 right =len(s)-1while left <= right: s[left], s[right]= s[right], s[left] left +=1 right -=1
classSolution:defreverseString(self,s: List[str]) ->None:""" Do not return anything, modify s in-place instead. """defhelper(left,right):if left <= right: s[left], s[right]= s[right], s[left]helper(left +1, right -1)helper(0, len(s) -1)