Valid Palindrome II



Given a string, return True if the string can be a palindrome after removing at most one character from it.

A phrase is a palindrome if it reads the same forward and backward after ignoring all non-alphanumeric characters like punctuation, symbols, capitalization, and spaces.

Input: abaaA!

Output: True

Removing character 'b' from the string would make it a palindrome. We ignore all non-alphanumeric characters like ! and capitalization.

Input: abaaza

Output: False

In this case, it would require removing more than one character, 'b' and 'z', from the string to make it a palindrome.

Clarify the problem

What are some questions you'd ask an interviewer?

Understand the problem

Based on the above criteria, which of these is NOT a valid palindrome?
m@d @m

Login or signup to save your code.