Skip to interview prep
Apexed

5. Valid Palindrome

EasyTwo pointers

Return true if s reads the same forwards and backwards after lowercasing it and ignoring every character that is not a letter or digit.

Example 1

Input: s = "Never odd or even"
Output: true

Example 2

Input: s = "race a car"
Output: false

Constraints

  • 0 ≤ s.length ≤ 2 × 10⁵
  • ASCII characters

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 6 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Valid Palindrome — coding interview practice — Apexed