Pattern5 visualizers
Two Pointers Pattern Visualizers
The Two Pointers pattern is a recurring algorithmic shape that appears across coding interviews and competitive problems. Use it when the problem geometry matches its trigger conditions — recognizing the pattern collapses what looks like a hard problem into a familiar template. These visualizers trace Two Pointers step-by-step on classics such as 3Sum, Find the Index of the First Occurrence in a String, Is Subsequence, so you can internalize the moves before you ever need them under pressure.
Two Pointers
3Sum
Sort the array, fix one element, then use two pointers on the remaining subarray to find all unique triplets that sum to zero.
Open visualizer →
Two Pointers
Find the Index of the First Occurrence in a String
Slide a window of needle's length across the haystack, comparing character by character to find the first match.
Open visualizer →
Two Pointers
Is Subsequence
Use forward two pointers to check if every character in s appears in t in order, without rearranging.
Open visualizer →
Two Pointers
Two Sum II - Input Array Is Sorted
Use opposing two pointers on a sorted array to find a pair that sums to the target in O(n) time and O(1) space.
Open visualizer →
Strings
Valid Palindrome
Use left and right pointers to scan inwards, skipping symbols and checking equality.
Open visualizer →