Alle Herausforderungen
Mittel 0 gelöst 0% Erfolgsquote

Recursive Palindrome

Check a palindrome recursively, ignoring case and punctuation.

Problem

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.

Einschränkungen

0 ≤ length ≤ 1,000

Beispiele

Beispiel 1
Eingabe:
text = "Never odd or even"

Erwartete Ausgabe:
expected = True
Eingabe:
std::string text = "Never odd or even";

Erwartete Ausgabe:
bool expected = true;
Eingabe:
string text = "Never odd or even";

Erwartete Ausgabe:
bool expected = true;

Erläuterung

Letters only, lowercased: "neveroddoreven" reads the same both ways.

Beispiel 2
Eingabe:
text = "code"

Erwartete Ausgabe:
expected = False
Eingabe:
std::string text = "code";

Erwartete Ausgabe:
bool expected = false;
Eingabe:
string text = "code";

Erwartete Ausgabe:
bool expected = false;

Erläuterung

"c" and "e" differ, so it is not a palindrome.

Referenzen

Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.

Von anderen lernen

Community-Lösungen

Noch keine veröffentlichten Lösungen. Löse die Aufgabe und teile als Erster eine Lösung.