← Visualizers
Opposite-Ends Two Pointers LeetCode 125

Valid Palindrome / visualized

Check if a string reads the same forwards and backwards, ignoring case and skipping anything that isn't a letter or digit. No deletions allowed — this is the strict version.

Execution

idle
Press Run to begin.
0 / 0
Speed

Java · running line

comparing matched mismatch skipping non-alphanumeric
O(n) time · O(1) extra space  ·  the two inner while loops are what let punctuation and spaces get skipped without a separate cleanup pass.