反转字符串 python3

def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
n=len(s)
left,right=0,n-1
while left<right:
temp=s[left]
s[left]=s[right]
s[right]=temp
left,right=left+1,right-1
return s

posted @ 2021-04-21 16:42  谁动了我的奶盖  阅读(42)  评论(0编辑  收藏  举报