Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
It's really simple in python
In our thinking the mathod of Reverse String is
return: s [::-1]
But it's didn't work in the Leetcode.
WTF!!!!!! Wrong Answer
Our except answer
I really confuse. But When I goolge the it why it didn't work. You may reset your memory in ans. Because the leetcode use the memory so your result didn't work.
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
s[:] = s [::-1]
return s [::-1]
I reset my memory in the leetcode
summit answer
So next time when I find thought my answer is wrong. I may sollow down. reset your memory