Reverse String

Easy

Topics
StringTwo Pointers

Given a string s, return the string reversed.

Example 1

Input:  s = "hello"
Output: "olleh"

Example 2

Input:  s = "abcd"
Output: "dcba"

Constraints

  • 1 <= s.length <= 10^5
  • s consists of printable ASCII letters.
Run ⌘' · Submit ⌘⏎