Valid Palindrome

Two pointers · Shrink from both ends · Easy · about 15 min

Why it matters

Two pointers often remove a nested loop without needing extra memory.

How it connects

Instead of remembering everything, use the shape of the input: two ends moving inward.

Try first

Ignore punctuation for a moment. Which two characters must agree first?

Interview cue

Each pointer only moves forward, so this is O(n) time and O(1) extra space.