Valid palindrome.
Given an input string. We have to write a code to check if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: For this problem, consider the empty string as a valid palindrome.
For Example –
Example 1:
Input: “A man, a plan, a canal: Panama”
Output: true
Explanation: After removing non-alphanumeric characters, the string is amanaplanacanalpanama. So, it’s a palindrome
Example 2:
Input: “race a car”
Output: false