FunctionRacerProblemsRace

Reverse String

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

Given a string s, return a new string with its characters in the opposite order.

For an empty string, return an empty string.

Example 1

s "hello"
returns "olleh"

Read the letters from the end: olleh.

Example 2

s "ab"
returns "ba"

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems