Code Tutor

|
Instructions
Easy

Reverse a String

Reverse an array of characters in-place.

Function Signature

void reverseString(char[] s)

Example

Input: ['h','e','l','l','o']
Output: ['o','l','l','e','h']

Constraints

  • 1 ≤ s.length ≤ 10^5
  • Use O(1) extra memory.
Loading editor...
Tutor
Tutor

Hello! I'm your Java coding tutor. How can I help you?