Interview question: Reverse a String
Problem Description
Given a string s
, write a function reverse_string(s: str) -> str
to reverse the input string and return the reversed string as output.
Function Signature
Output
The reversed string of s
.
Example
Example 1
Input: s = "hello"
Result: "olleh"
Example 2
Input: s = "Tesla"
Result: "alseT"
Example 3
Input: s = "12345"
Result: "54321"