Your question is Palindrome With Non-Alphanumerics. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
OneTrust Privacy Management may receive user-entered text containing punctuation, spaces, and inconsistent capitalization. Given a string, determine whether it is a palindrome after removing every non-alphanumeric character and ignoring letter case.
Implement is_palindrome(s), where s is a string containing ASCII letters, digits, spaces, and punctuation. Return True if the cleaned string reads identically from left to right and right to left. Return False otherwise. An empty cleaned string is considered a palindrome.
Use a two-pointer approach that compares characters from both ends without creating a separate cleaned string.
def is_palindrome(s):