Skip to the editor
JSGroundwork
JSGroundwork handwritten · web dev
←Back to Two pointers

Ready to read

JSJavaScript⑂Git◎Interview prepΣDSA in JSSDSystem Design
More topics15›
</>HTML{ }CSS⚛ReactNNext.jsNeNest.jsTSTypeScriptNoNode.js🐳DockerDBSQL & Databases✓Testing🔒Web Security☁Cloud & DevOps◈GraphQL◆Redis☸Kubernetes
☰‹›
Description
All topics›JavaScript›Two pointers

Valid Palindrome

beginnerlayer B4 · Two pointers5 tests

Write isPalindrome(s). Ignore every character that is not a letter or a digit, treat upper and lower case as equal, and report whether what is left reads the same forwards and backwards.

  • Punctuation and spaces are skipped entirely, not replaced
  • Digits do count as content
  • A string with no alphanumeric characters at all is a palindrome
  • Aim for O(1) extra space — do not build a cleaned copy of the string

Stuck?

All exercisesPlayground
1234567891011121314
loading the editor…

Nothing yet — hit Run and whatever you log shows up here.

Submit to see how you did.

⌘/Ctrl + Enter run⌘/Ctrl + S save⌘/Ctrl + / comment⌘/Ctrl + F find/replace⌘/Ctrl + D select next matchAlt + click multi-cursorTab indent · ⇧Tab outdentEsc leave fullscreen