X495: Recursion - Scrambler

Design a recursive method for scrambling Strings of length 3 or more. It must swap the first and last character of the input String, then split the String in half and do it again to each half.

Examples:

scramble("Banana") -> "naaBan"
scramble("Pineapple") -> "ieenpPapl"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.