Day 30 of 133

Design patterns — creational / structural / behavioral + DSA Heap

Factory, builder, adapter, strategy, observer — and when each is wrong.

DSA · NeetCode Heap / Priority Queue

  • Task SchedulerDSA · Heap / Priority Queue

    Interview questions to prep

    1. Why is a heap the right structure? Could a balanced BST or sorted list work — why is heap better?
    2. Explain the heap-of-k pattern: keep size k, push new, pop if over k. What's the resulting complexity?
    3. What does the comparator look like, and how would you tweak it to flip min/max behaviour?
  • Design TwitterDSA · Heap / Priority Queue

    Interview questions to prep

    1. Why is a heap the right structure? Could a balanced BST or sorted list work — why is heap better?
    2. Explain the heap-of-k pattern: keep size k, push new, pop if over k. What's the resulting complexity?
    3. What does the comparator look like, and how would you tweak it to flip min/max behaviour?

SWE · Design patterns

  • Creational: factory, builder, singletonOOPS / SWERefactoring.guru

    Interview questions to prep

    1. When is a singleton an anti-pattern in tests?
    2. Compare factory vs abstract factory vs builder.
  • Structural: adapter, decorator, facadeOOPS / SWERefactoring.guru

    Interview questions to prep

    1. When would you reach for an adapter vs a facade?
    2. Where does the decorator pattern show up cleanly in an ML inference pipeline?
  • Behavioral: strategy, observer, commandOOPS / SWERefactoring.guru

    Interview questions to prep

    1. Show how the strategy pattern lets you swap ML models without touching call sites.
    2. When does observer cause subtle bugs in a high-throughput system?

References & further reading