Reverse String

Write a function that reverses a string by modifying the input array of characters in-place using O(1) extra memory.

Constraints

  • 1 <= s.length <= 10^5
  • s[i] is a printable ascii character.
Saving… · 2 lines
class Solution:
def reverse_string(self, s) -> None:
Console

Click Run to execute sample tests.