Course · Interview preparation
Data structures and algorithms, by pattern
Interview problems grouped by the technique that solves them, from prefix sums to graphs. Every problem here is written from scratch, and every solution is code that ran against its tests before it reached the page.
- Lessons
- 43
- Problems
- 247
- Diagrams
- 43
- Tested cases
- 1,722
- Modules written
- 14 of 14
- Reading time · words
- 18 h · 247,172
Outline
Module 01 · 3 pages
Start here
Module 02 · 2 days · 10 pages
Arrays and prefix thinking
One pass
Module 03 · 4 days · 18 pages
Binary search and the predicate framework
The predicate
Module 04 · 3 days · 17 pages
Two pointers and sliding windows
Two pointers
Module 05 · 4 days · 20 pages
Sorting, comparators and intervals
Order as a key
Intervals
Module 06 · 3 days · 14 pages
Hashing and search structures
Hash maps
Module 07 · 4 days · 18 pages
Lists, stacks, queues and design
Linked lists
Stacks and queues
Module 08 · 5 days · 22 pages
Recursion and backtracking
The framework
Backtracking
Module 09 · 2 days · 11 pages
Heaps
Heaps
- The heap invariant7 min
- Top-k and two heaps7 min
- The k lightest crateseasy3 min
- Stitching the station logsmedium3 min
- The board shows the medianhard4 min
- The card catalogue mergehard3 min
- The nth bell in the pattern bookmedium3 min
- The nearest drill bits in the cataloguemedium4 min
- Screen-print rotationmedium3 min
- Tug-of-war laddereasy3 min
- Back-to-back on airmedium3 min
Module 10 · 5 days · 23 pages
Trees and BSTs
Traversal
Structure and paths
Module 11 · 4 days · 18 pages
Tries and strings
String algorithms
- Palindromes6 min
- KMP and the failure function5 min
- One tray per formulamedium3 min
- The marquee swapeasy3 min
- Fly-rail cue sheeteasy3 min
- The sundial mottoeasy3 min
- The leaded stripmedium3 min
- Mirrored fillsmedium3 min
- One wire, many labelsmedium3 min
- Tremor signaturemedium4 min
- Mirrored avenuehard4 min
- Motif on the rollmedium4 min
- Turnstile audithard3 min
- The permissions deskmedium3 min
Module 12 · 8 days · 63 pages
Dynamic programming
Linear DP
- What DP actually is6 min
- Linear DP6 min
- The roofline runhard3 min
- The hive scaleeasy3 min
- Teeth on the wheelsmedium3 min
- Zigzag bordermedium3 min
- Crossing the pontoonseasy3 min
- The clean round bonusmedium3 min
- Starting the ridge relayhard4 min
- Loudest run on the boardmedium3 min
- Posts on an even gradeeasy3 min
- The fly cue sheetmedium3 min
- Terrace climbseasy3 min
- One struck readingmedium4 min
- Tints in the stair windowmedium3 min
- Booking the soundstageseasy3 min
- Pitches round the market ringmedium3 min
- The jukebox slipmedium4 min
- The blurred count cardhard4 min
- Copper at the weighbridgemedium4 min
- The clearing daymedium3 min
Subsequences and strings
- Two sequences5 min
- The rising traversemedium3 min
- The period in a sighting ledgermedium3 min
- Two hydrophonesmedium3 min
- Blends off the blottermedium3 min
- The seed tray laddermedium3 min
- Reading the punch tapemedium4 min
- Marquee changeoverhard4 min
- The bead strand mirrormedium4 min
- Motif in the weavehard4 min
- Readings of the friezehard4 min
Knapsack
Interval and matrix
- Intervals and matrices6 min
- Two trips through the stackshard4 min
- Quilt of squareshard3 min
- Splitting the ripening shelfmedium3 min
- Head of the chutehard3 min
- Two crews, one sidingmedium4 min
- Paying by the traymedium4 min
- The lantern wirehard4 min
- Joints in the kiln lininghard3 min
- Down the lock gridmedium4 min
- Squares in the mosaicmedium4 min
- Height off the winchhard4 min
Tree, digit and bitmask
- Tree, digit and bitmask DP7 min
- Wax pourshard4 min
- Setting the folioshard4 min
- The searchable sectionhard4 min
- The pier tickerhard4 min
- Stamping the key blanksmedium4 min
- The espalier weavemedium4 min
- Loading the glaze shedhard3 min
- Cutting the parcel spurmedium4 min
- The storm-drain surveymedium3 min
- Standing the pipe rankhard4 min
- The broken dialhard4 min
- Bays the reader flagshard4 min
Module 13 · 1 day · 7 pages
Greedy
Module 14 · 6 days · 46 pages
Graphs
Traversal and connectivity
- Representing a graph5 min
- BFS and DFS5 min
- What is left of the sheeteasy3 min
- Air pockets in the castingmedium3 min
- Lichen on the north wallmedium3 min
- Shunting to an exiteasy3 min
- Paper by the reammedium3 min
- Handing out the allotmentshard3 min
- The cold store keyringeasy4 min
- Two cabinetsmedium3 min
- Sheep that cannot straymedium3 min
- Repainting the lido mosaiceasy3 min
Cycles and ordering
- Cycles and topological order6 min
- The slipway job cardsmedium3 min
- Reassembling the tower clockmedium3 min
- Tracks that come to restmedium3 min
- Dye house shade indexhard3 min
- The tunnel to sealmedium3 min
- The branch van rotahard3 min
- Conservation precedencemedium4 min
- One call line too manyhard4 min
- Winters on the cutmedium3 min
Shortest paths
- Shortest paths6 min
- The nearest standpipemedium3 min
- The longest swimmedium3 min
- Word from the fire towersmedium3 min
- Recutting the master keyhard3 min
- Opening the head sluicemedium4 min
- Every shortest call-sign runhard3 min
- Crossing the mudflatsmedium3 min
- The backload ledgermedium3 min
- Blue mould on the benchmedium3 min
- Turning the alleys roundmedium3 min
- The transfer ticketmedium3 min
- The quietest refugemedium3 min
- Routing the containermedium3 min
Union-find and components
- Union-find5 min
- Merging the choir rostermedium3 min
- Wings of the one-way househard3 min
- Repatching the rigmedium3 min
- The pneumatic posthard3 min
- The mill floor loadmedium3 min
- The largest slab in the quarrymedium3 min
- The trunk line surveyeasy3 min
- The cask ledgermedium3 min
- Striking the scaffold tiesmedium3 min
