Design
Design problems ask you to build a data structure or system to a spec — an LRU cache, a rate limiter, an iterator — choosing the right internal structures so each operation hits its target complexity. They test API design as much as algorithms.
14 LeetCode problems solved with the Design pattern. Practice them with spaced repetition so the pattern sticks.
- Binary Search Tree IteratorMEDIUM · O(1) amortized per next/hasNext
- Design Circular QueueMEDIUM · O(1)
- Design HashMapEASY · O(1)
- Design HashSetEASY · O(1)
- Design TwitterMEDIUM · O(F + k log F)
- Detect SquaresMEDIUM · O(n) per count, O(1) per add
- Encode and Decode StringsMEDIUM · O(n)
- Implement Queue using StacksEASY · O(1)
- Implement Stack using QueuesEASY · O(n) push, O(1) pop/top (push-costly variant)
- Insert Delete GetRandom O(1)MEDIUM · O(1)
- LFU CacheHARD · O(1)
- LRU CacheMEDIUM · O(1)
- Maximum Frequency StackHARD · O(1)
- Time Based Key-Value StoreMEDIUM · O(log n)
See the full solution
The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.
Start free →