Problema
Decide whether text reads the same forwards and backwards, considering only letters and digits and ignoring case. Solve it recursively: compare the outer characters, then check the inside.
Implement is_palindrome_recursive(text).
Input
text: The text to check (ASCII characters).
Output
Return true for a palindrome, otherwise false.
Vincoli
0 ≤ length ≤ 1,000
Esempi
Input:
text = "Never odd or even"
Output atteso:
expected = True
Input:
std::string text = "Never odd or even";
Output atteso:
bool expected = true;
Input:
string text = "Never odd or even";
Output atteso:
bool expected = true;
Spiegazione
Letters only, lowercased: "neveroddoreven" reads the same both ways.
Input:
text = "code"
Output atteso:
expected = False
Input:
std::string text = "code";
Output atteso:
bool expected = false;
Input:
string text = "code";
Output atteso:
bool expected = false;
Spiegazione
"c" and "e" differ, so it is not a palindrome.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.