Reverse String

Easy~10 min

Given a string s, return the string reversed.

For example, if the input is "hello", the output should be "olleh".

Examples

Example 1
Input: s = "hello"
Output: "olleh"
Explanation: The characters are reversed from back to front.
Example 2
Input: s = "world"
Output: "dlrow"
Example 3
Input: s = "a"
Output: "a"
Explanation: A single character is already its own reverse.

Constraints

  • 0 <= s.length <= 10^5
  • s consists of printable ASCII characters.
Code
Ctrl+EnterRun|Ctrl+⇧+EnterSubmit
Output

Run your code to see results

Use Cmd+Enter to run