Two Pointers Visualization

Step through Two-Sum / Palindrome / Remove Duplicates on an array

Demo Configuration

Array

Ready. Click Step or Auto-Play to begin.
L pointer
R pointer
L = R
Fast pointer
Match / kept
Mismatch

Controls

Operation Log

Statistics

0
Step
-
Left / Slow
-
Right / Fast
0
Array Size
0
Comparisons
0
Writes/Swaps

Big-O Complexity

VariantTimeSpace
ConvergingO(n)O(1)
Slow/FastO(n)O(1)
Merge-styleO(n+m)O(1)
Brute force pairO(n^2)O(1)

Variant Cheatsheet

Converging: L at 0, R at n-1, move inward.
Slow/Fast: both at 0; fast scans, slow writes.
Merge: i on A, j on B; advance smaller side.