Leetcode 344 Solution
This article provides solution to leetcode question 344 (reverse-string)
Access this page by simply typing in "lcs 344" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/reverse-string
Solution
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
def dfs(s, i, j):
if i >= j:
return
s[i], s[j] = s[j], s[i]
dfs(s, i + 1, j - 1)
dfs(s, 0, len(s) - 1)