Day 29 of 133
OOPS pillars & SOLID principles + DSA Heap
SRP, OCP, LSP, ISP, DIP — pick the one you violate most and refactor.
DSA · NeetCode Heap / Priority Queue
- K Closest Points TO OriginDSA · 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?
- Kth Largest Element IN AN ArrayDSA · Heap / Priority Queue
Interview questions to prep
- Compare heap (O(n log k)), sort (O(n log n)), quickselect (O(n) avg) — when does each fit?
- What's quickselect's worst case, and how do you avoid it (median-of-medians, randomization)?
SWE · OOPS & SOLID
Interview questions to prep
- Walk through the four pillars of OOP with code examples.
- When does composition beat inheritance?
Interview questions to prep
- Walk through each SOLID principle with a real example.
- Which SOLID principle do you violate most often, and why?
Interview questions to prep
- Spot a god class — what would you refactor it into?
- Why are deep inheritance hierarchies usually a smell, and what do you reach for instead?
References & further reading
- SOLID principles ↗DigitalOcean
- Refactoring.guru — design patterns ↗Refactoring.guru