Interview Patterns (recognize the shape, apply the template)
Pattern Recognition · Open board
Four scenes, one per pattern: a window sliding across a string, two pointers walking a sorted array inward, a fast pointer lapping a slow one around a loop, and a hand choosing, exploring, then undoing through a set of choices. A table underneath sorts an unseen problem into one of ten shapes by the words in its ask.
Before you start.Algorithm Design Patterns gave you the four families a solution can come from: divide and conquer, greedy, dynamic programming, backtracking. Capstone: Attack an Unseen Problem gave you the seven-step way to attack a problem you’ve never seen. This lesson speeds up its planning step: recognize a handful of shapes on sight, instead of inventing a plan from nothing.
Lesson 16 of 96 in DSA
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.
Or start free: a free account opens lessons 2 and 3 of every track.
In this lesson
1977: a name for the shape you keep rebuilding
The tell: a sorted array, and a pair to find
The tell: a run that only grows and shrinks
The tell: a list you can’t jump around in
The tell: “generate every one”
Two pointers, the template and the fix
Sliding window, the template and the measured cost
Fast & slow pointers (Floyd), the template
Backtracking, the template
Binary search on the answer, a fifth shape
The rest of the catalogue, briefly
Recognize the shape, the tell → pattern table
The method when nothing matches
Terms it explains: sorted, monotonic, Heap / top-k, Prefix sums, static, Dynamic programming, brute force first, find the bottleneck, match a pattern, verify, contiguous.