Reverse a String

Given a string str, reverse it using recursion without using extra data structures.

Example 1:

Input: str = "hello"

Output: olleh

Example 2:

Input: str = "tuf"

Output: fut

Now Your Turn!

Pick the correct output for the given input

Input: str = "welcome"

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= string length <= 100
  • string may contain: lowercase or uppercase letters
0
class Solution{
public:
string reverseString(string str){
//your code goes here
}
};
Test Case

Input:

Str