Valid Palindrome
Easy
Two Pointers
MicrosoftMeta
A phrase is a palindrome if, after lowercasing and removing non-alphanumeric characters, it reads the same forwards and backwards.
Input: one line.
Output: "true" or "false".
Input: one line.
Output: "true" or "false".
Examples
Input:
A man, a plan, a canal: Panama
Output:
true
Constraints
1 <= length <= 2*10^5
Sample test cases
Input
A man, a plan, a canal: Panama
Expected output
true
Input
race a car
Expected output
false
Try solving it yourself first 💪
Write your solution in the editor, then hit “Mark solved”. In-browser run & auto-check is coming soon.