A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise.
Example 1
Input: s = A man, a plan, a canal: Panama
Output: true
Explanation: After lowercasing and removing non-alphanumerics it reads 'amanaplanacanalpanama', which is the same forwards and backwards.
Example 2
Input: s = race a car
Output: false
Explanation: After cleaning, the string is "raceacar", which reads "racaecar" backwards. They differ, so it is not a palindrome.
Example 3
Input: s =
Output: true
Explanation: After removing non-alphanumeric characters the string is empty, and an empty string reads the same both ways.
A palindrome reads the same from both ends, so walk one pointer in from the left and one in from the right, skipping anything that isn't a letter or digit, and compare the characters they land on.
Run checks all cases above. Submit evaluates all test cases.