This post is completed by 1 user
|
Add to List |
290. Reverse a String using Recursion
Objective: Given a String, write a recursive program to reverse it.
Example:
Original String: tutorial horizon Reversed String: noziroh lairotut
Approach:
- Take the first character out of the string, add it to the end of result of the remaining string.
- Make a recursive call to remaining string.
Output:
Original String: tutorial horizon Reversed String: noziroh lairotut