Given a string `s`, return true if it is a palindrome after converting all uppercase letters to lowercase and removing all non-alphanumeric characters.
Examples
Example 1 Input:s = "A man, a plan, a canal: Panama"
Output:true
Explanation: "amanaplanacanalpanama" is a palindrome.
Example 2 Input:s = "race a car"
Output:false
Constraints
▪1 <= s.length <= 2 * 10^5
▪s consists of printable ASCII characters.
Hints
Hint 1Show
First, clean the string by removing non-alphanumeric characters and converting to lowercase.
Hint 2Show
Then check if the cleaned string reads the same forwards and backwards.
Starter Code
Solution.py
1def is_palindrome(s: str) -> bool:
2 # Your code here
3 pass
Solution
Solve the problem first before reviewing the solution!