0125. Valid Palindrome
Easy | Two Pointer | 36 ms (95.59%), 14.7 MB (61.30%)
Source: LeetCode - Valid Palindrome GitHub: Solution / Performance
Given a string s
, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Two pointers: One from the left (start) and the other from the right (end).
Note that when left > right
inside the while loop and the algorithm has not returned the False, we could return True directly.
Last updated
Was this helpful?