← Home
Optional trackAnytime ~3.5 hnot on the exam
Level Up: Problem Patterns
Optional interview patterns built on this course. Not on the exam.
These patterns reuse arrays, linked lists and stacks from the course to solve interview-style problems quickly. Finish the chapter they build on first. They will make you faster at the exam's "write a function" questions, but nothing here is examined directly.
Slides: Two Pointers Slides: Sliding Window Slides: Prefix Sum Slides: Linked List (fast & slow) Slides: Stacks, Queues and Monotonicity
- LU.1Two PointersTwo indices that move toward each other (or in the same direction) to replace an O(n²) pair search with one O(n) pass. 40 minmedium
- LU.2Sliding WindowKeep a running answer for a contiguous range, adding the item that enters and removing the one that leaves, instead of recomputing every window. 45 minmedium
- LU.3Prefix SumPrecompute running totals once in O(n), then answer any range-sum query with one subtraction in O(1). 35 mineasy
- LU.4Fast & Slow PointersTwo pointers moving through a linked list at different speeds find the middle, the n-th node from the end, and cycles (Floyd's algorithm) in one pass with O(1) space. 40 minmedium
- LU.5Monotonic StackA stack kept in sorted (decreasing) order answers "next greater element" and "how far away is it" for every index in one O(n) pass. 50 minhard