Palindrome Check
Easy
Strings
String
Two Pointers
Given a string, determine if it is a palindrome (reads the same forwards and backwards). Consider only alphanumeric characters and ignore case.
Constraints
1 ≤ s.length ≤ 2 × 10^5
Examples
Example 1:
Input: A man, a plan, a canal: Panama
Output: true
Explanation: Ignoring non-alphanumeric: 'amanaplanacanalpanama'
Example 2:
Input: race a car
Output: false
Hints
Filter non-alphanumeric, then compare.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console