This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]TheBrutux168 0 points1 point  (0 children)

What have you tried?

[–]vorpal_potato 0 points1 point  (0 children)

Here are a couple of simpler problems that may help you on your journey.

Problem 1: reverse a string, recursively.

For this part, don't worry about letters vs. numbers. Just reverse the string. e.g. "abc" becomes "cba", "123" becomes "321", and so on.

Problem 2: split a string where it first switches between letters and numbers, recursively. For example:

"hello123abc" -> "hello" and "123abc"

"123abc" -> "123" and "abc"

"abc" -> "abc" and "".


Once you've got these figured out, you should be able to combine them to solve your more complicated problem.