Is it even possible to define a recursive method for palindrome checkup with the following argument list?
int testPalindromeRecursive(char* str, int len) { ... }
Note: no external sub-functions or global variables have to be used
I think this is impossible, because you have to remember the last (front) index position somehow.
Yes, it is completely possible - as several people have mentioned.
Base Cases:
Else: recurse with (str+1, len -2)
1) A string with no characters or just a single character is a palindrome
2) if the first and last characters of a string with 2 or more characters are equal, and the substring excluding the terminal characters is a palindrome, the whole string is a palindrone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With