728x90
LeetCode-344
ReverseString : ๋ฌธ์์ด ๋ฆฌ์คํธ ๋ค์ง๊ธฐ
๋ฆฌํด ์์ด ๋ฆฌ์คํธ ๋ด๋ถ์ ์ฃผ์ ๊ฐ์ด ๋ณํ๋๋ก
my answer
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
for i in range(len(s)):
s.append(s.pop(-i-1))
Result : 394 Memory: 18.4mb
1. ํฌ ํฌ์ธํธ ์ค์
{code}
Result : 205 Memory: 18.5mb
๋ฐ์ํ
'๐ข One step' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
LeetCode - Time complexity ์๊ฐ ๋ณต์ก๋ (0) | 2023.03.02 |
---|---|
[leetcode-819] Most Common Word (0) | 2023.03.02 |
[leetcode-937] Reorder_Data_in_LogFile (0) | 2023.03.01 |
[leetcode-125] Palindrome + Slicing (0) | 2023.02.27 |
[leetcode-125] Palindrome (0) | 2023.02.26 |