#125

Valid Palindrome

Easy Opposite ends

  1. Read
  2. Understand
  3. Hints
  4. Approach
  5. Solution
  6. Solved

?The problem

Ignoring case and every character that isn't a letter or digit, decide whether a string reads the same both ways.

This is a short summary in our own words. Read the full statement and examples on LeetCode: open problem ↗

◎Understanding

Really asking: ignoring case and symbols, does it read the same both ways?

Why this works: compare from both ends, skipping anything that isn't a letter or digit.

Example: "A man, a plan, a canal: Panama"

'a' vs 'a', 'm' vs 'm', 'a' vs 'a' …all pairs match → true

✦Hints open one at a time

↗Approach

</>Solution (Java)

!Common mistake

Building a cleaned copy of the string — fine, but it uses O(n) extra space you don't need.