समस्या
अनुवाद दिखाएँ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.
सीमाएँ
0 ≤ length ≤ 1,000
उदाहरण
इनपुट:
text = "Never odd or even"
अपेक्षित आउटपुट:
expected = True
इनपुट:
std::string text = "Never odd or even";
अपेक्षित आउटपुट:
bool expected = true;
इनपुट:
string text = "Never odd or even";
अपेक्षित आउटपुट:
bool expected = true;
व्याख्या
Letters only, lowercased: "neveroddoreven" reads the same both ways.
इनपुट:
text = "code"
अपेक्षित आउटपुट:
expected = False
इनपुट:
std::string text = "code";
अपेक्षित आउटपुट:
bool expected = false;
इनपुट:
string text = "code";
अपेक्षित आउटपुट:
bool expected = false;
व्याख्या
"c" and "e" differ, so it is not a palindrome.
संदर्भ
यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।