-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path344_reverse_string.py
More file actions
17 lines (14 loc) · 1.47 KB
/
Copy path344_reverse_string.py
File metadata and controls
17 lines (14 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Solution:
def reverseString(self, s):
i = 0
length = len(s) - 1
while i < length:
temp = s[i]
s[i] = s[length]
s[length] = temp
i = i + 1
length = length - 1
testing = Solution()
print(testing.reverseString(["h","Y","T","A","9","f",",","?","K","\"",",",":","S","M","v","\"","0","r","R","!","2","V","S"," ","K",":","4","q","2","`","5"," ","'","7",",","S","`","6",",","w",".","W","w","O","'",":","h","0","d","y","b",",","E","`","V",".","7","C",":","0","T",","," ","5","Y","4"," ",",","m","E","u","j",".","d","J","\""," ","i","I","Y","f","?","?","3","p","\"",".",";","9","h","1","q",",","K","b","h",".","O",".","?",";","H","i","?","`","\"","`","j",";","H","\"",".","4","8","5",":",":","B","E","O","P"," ","'",":","B","6",";","0","0","1","a","Q","P","9","6","B","9",";","?","?",";","9","B","6","9","P","Q","a","1","0","0",";","6","B",":","'"," ","P","O","E","B",":",":","5","8","4",".","\"","H",";","j","`","\"","`","?","i","H",";","?",".","O",".","h","b","K",",","q","1","h","9",";",".","\"","p","3","?","?","f","Y","I","i"," ","\"","J","d",".","j","u","E","m",","," ","4","Y","5"," ",",","T","0",":","C","7",".","V","`","E",",","b","y","d","0","h",":","'","O","w","W",".","w",",","6","`","S",",","7","'"," ","5","`","2","q","4",":","K"," ","S","V","2","!","R","r","0","\"","v","M","S",":",",","\"","K","?",",","f","9","A","T","Y","h"]))
#runtime: 0ms, beats 100.00%
#memory: 23.44MB, beats 45.64%