A phrase is a palindrome if, after converting all uppercase characters into lowercase characters 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.
1 ≤ s.length ≤ 2 * 10⁵s consists only of printable ASCII characters.Convert the string to lowercase and remove non-alphanumeric characters.
The question is really about a different string from the one you're given. Throw away everything that isn't a letter or a digit, lowercase what's left, and ask whether that reads the same both ways. "Top spot!" becomes "topspot", which does.
Time O(n)Space O(1)
The full walkthrough and code are part of Premium
true