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
- Why is a heap the right structure? Could a balanced BST or sorted list work — why is heap better?
- Explain the heap-of-k pattern: keep size k, push new, pop if over k. What's the resulting complexity?
- 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
- Why is a heap the right structure? Could a balanced BST or sorted list work — why is heap better?
- Explain the heap-of-k pattern: keep size k, push new, pop if over k. What's the resulting complexity?
- What does the comparator look like, and how would you tweak it to flip min/max behaviour?
SWE · Design patterns
Interview questions to prep
- When is a singleton an anti-pattern in tests?
- Compare factory vs abstract factory vs builder.
Interview questions to prep
- When would you reach for an adapter vs a facade?
- Where does the decorator pattern show up cleanly in an ML inference pipeline?
Interview questions to prep
- Show how the strategy pattern lets you swap ML models without touching call sites.
- When does observer cause subtle bugs in a high-throughput system?
References & further reading
- Refactoring.guru — design patterns ↗Refactoring.guru