The second requirement is obviously an extension of the first, and so it's possible to write a recursive function which does both. It has a special case for the single digit length string, just checking if it needs to be flipped or not.
The second requirement is obviously an extension of the first, and so it's possible to write a recursive function which does both. It has a special case for the single digit length string, just checking if it needs to be flipped or not.