Skip to Main Content

Reverse String

Problem URL:Reverse String

My Solution:

Input is modified in-place.

def reverseString(s: List[str]) -> None:
    for i in range(len(s)//2):
        s[i], s[-(i+1)] = s[-(i+1)], s[i]

Let's Connect

Twitter GitHub LinkedIn