Tasks /
Algorithms /
Palindrome
Statement
easy
Palindrome
Implement `is_palindrome(text)`: does the string read the same in both
directions?
Rules:
- case does not matter;
- spaces and punctuation are ignored;
- an empty string and a string without letters count as a palindrome.
Use two pointers: skip non-alphanumeric characters and compare from both ends.
AI mentor
The AI mentor is available after you log in: it sees your attempt history and does not spend resources on anonymous requests.
Log in and ask
Hints
1 of 3 unlocked · attempts: 0
Hint 1
What do you do with characters that are neither letters nor digits? They cannot
be compared, but the pointer still has to move carefully.
Hint 2 — unlocks after 1 attempt
Hint 3 — unlocks after 3 attempts