-
-
Notifications
You must be signed in to change notification settings - Fork 298
/
Copy path344.py
23 lines (23 loc) · 852 Bytes
/
344.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
__________________________________________________________________________________________________
sample 200 ms submission
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
s = s.reverse()
__________________________________________________________________________________________________
sample 17192 kb submission
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
head = 0
tail = len(s) - 1
while head < tail:
s[head], s[tail] = s[tail], s[head]
head += 1
tail -= 1
print(s)
__________________________________________________________________________________________________