Your question is Palindrome or String Manipulation. 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.
The NatWest mobile app receives customer reference strings that may contain spaces, punctuation, and mixed casing. Write a function that determines whether the reference reads identically forwards and backwards after ignoring non-alphanumeric characters and letter casing.
Implement is_palindrome(reference), where reference is a string. Return True if the normalized string is a palindrome, otherwise return False. Normalization removes every character that is not alphanumeric and compares letters without regard to case. The original string must not be modified.
Use a two-pointer approach that compares characters from the beginning and end while moving towards the center.
def is_palindrome(reference):