← Visualizers
Two-Pointer Pattern LeetCode 680

Valid Palindrome II / visualized

Check whether a string can become a palindrome by deleting at most one character. Type any string below and watch the pointers close in — when they disagree, the algorithm forks: it tries skipping left, then skipping right.

Execution

idle
Press Run to begin.
0 / 0
Speed

Java · running line

comparing matched mismatch skipped char
O(n) time · O(1) extra space  ·  the fork adds at most one extra linear pass, so it stays linear overall.