Design Data Structures problems, grouped by pattern
Design problems ask you to build a class with fast operations. The skill is choosing the right trade-off: pre-compute on insert or on query, and pick a structure that makes every operation fit the target complexity.
When to reach for it
- Implement a class with several methods
- Each method has a complexity target
- A standard structure needs one extra operation
Mistakes to watch for
- Forgetting to keep auxiliary structures in sync
- O(n) operations hiding in a method meant to be O(1)
- Edge cases on empty structures
The 6 problems
1Pre-processing + tradeoffs
- Design Neighbor Sum Service Animated Easy
2Linked Lists
- Design Linked List Animated Medium
- Design Front Middle Back Queue Animated Medium
3Stack
- Min Stack Animated Medium
- Design a Stack With Increment Operation Animated Medium
- Maximum Frequency Stack Animated Hard