Well done!
You have completed Recursion with String and Lists Quiz!
Quiz Question 1 of 5
When modifying the palindrome()
function to check for palindromes in a string containing spaces and special characters, which of the following approaches would be most effective in ensuring accurate identification?
Choose the correct answer below:
-
A
Modify the base case to account for special characters, which would prevent incorrect recursion steps.
-
B
Recursion is not suitable for such a case, and an iterative approach should be used instead.
-
C
Strip all non-alphanumeric characters before starting the recursion to maintain string integrity.
-
D
Use a regular expression to clean the string before each recursive call, ensuring all characters are treated equally.