Search⌘ K
AI Features

Reverse String

Explore how to reverse a character array in-place by modifying the original string using the two pointers technique. Understand the constraints of constant extra space and apply this efficient approach to solve common coding interview problems.

Statement

You are given a character array, s, representing a string. Write a function that reverses the array in-place.

  • The reversal must be done by modifying the original array directly.

  • You cannot use extra memory beyond a constant amount O(1)O(1) ...