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

    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?
  • Kth Largest Element IN AN ArrayDSA · Heap / Priority Queue

    Interview questions to prep

    1. Compare heap (O(n log k)), sort (O(n log n)), quickselect (O(n) avg) — when does each fit?
    2. What's quickselect's worst case, and how do you avoid it (median-of-medians, randomization)?

SWE · OOPS & SOLID

References & further reading