125. Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: For the purpose of this problem, we define empty string as valid palindrome.
Example 1:
Example 2:
Thoughts:
Lower-case the string and have two pointers starting from first and last to check the legit characters until two pointers cross each other over
Code: Two pointers explicit
Code: Two pointers implicit (by comparing the reverse of the string itself)
Last updated
Was this helpful?