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

2Linked Lists

3Stack