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.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.