Valid Palindrome
A phrase is a palindrome if, after converting all uppercase letters to lowercase and removing every character that is not a letter or digit, it reads the same forward and backward. Given a string s, return true if it is a palindrome under those rules, and false otherwise.
Open official problem prompt ↗Decide whether a string is a palindrome once letters are lowercased and all other characters are ignored.
Two proofreaders start at opposite ends of a sentence and walk toward the middle, silently skipping spaces and punctuation, and only stop to argue when the letters they land on disagree.
- Input
- s = "A man, a plan, a canal: Panama"
- Output
- true
- Why
- Filtered and lowercased, s becomes 'amanaplanacanalpanama', which reads identically in reverse.
1 <= s.length <= 2 * 10^5s consists only of printable ASCII characters