A palindrome reads the same forwards and backwards, like racecar. Return true if text is a palindrome when you ignore capital letters, spaces and punctuation (only letters and digits count). Otherwise return false.
Text with no letters or digits at all (including empty text) counts as a palindrome.
text uses plain English characters and can be up to 20,000 characters long.
Input: isPalindrome("racecar")
Output: true
Input: isPalindrome("A man, a plan, a canal: Panama")
Output: true
Input: isPalindrome("hello")
Output: false
Your solution is checked against 3 example tests and 10 hidden tests (edge cases and bigger inputs).
Languages you don't learn in class are worth more: C++ 1.25×, JavaScript, TypeScript, C, Rust and Go 1.5×. Your first solve in a language unlocks its "Learned" achievement: +25 for learning it.
Loading editor...
Run Code checks the example tests. Submit runs every test, including hidden ones.