We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c07415b commit 1f414e9Copy full SHA for 1f414e9
344. Reverse String.py
@@ -0,0 +1,29 @@
1
+# -*- coding: utf-8 -*-
2
+# @Time : 2019/2/28 9:57
3
+# @Author : xulzee
4
+# @Email : xulzee@163.com
5
+# @File : 344. Reverse String.py
6
+# @Software: PyCharm
7
+from typing import List
8
+
9
10
+class Solution:
11
+ def reverseString1(self, s: List[str]) -> None:
12
+ """
13
+ Do not return anything, modify s in-place instead.
14
15
+ s.reverse()
16
17
+ def reverseString(self, s: List[str]) -> None:
18
19
20
21
+ l = len(s)
22
+ for i in range((l - 1) // 2 + 1):
23
+ s[i], s[l - i - 1] = s[l - i - 1], s[i]
24
25
26
+if __name__ == '__main__':
27
+ A = [2, 7, 11, 15]
28
+ Solution().reverseString(A)
29
+ print(A)
0 commit comments