Palindrome Checker
easySave
StringTwo Pointers
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Example 1
Input
[ "A man, a plan, a canal: Panama" ]
Output
true
Explanation. Ignoring punctuation and case, 'amanaplanacanalpanama' is a palindrome.
Example 2
Input
[ "race a car" ]
Output
false
Explanation. Ignoring punctuation and case, 'raceacar' is not a palindrome.
Example 3
Input
[ " " ]
Output
true
Explanation. An empty string or a string with just space characters is considered a palindrome.
Example 4
Input
[ "Noon" ]
Output
true
Explanation. Ignoring case, 'noon' is a palindrome.
Follow-up: Can you solve the problem without using extra space?
Constraints:
The input string will contain only printable ASCII characters.
- Views
- 2