👉 When Amazon asks for problems involving running medians, balancing data, or minimizing differences,
the Two Heaps Pattern is the go-to approach.







🎯 Core Idea



Maintain two heaps:




Max-Heap → stores the smaller half of numbers.

Min-Heap → stores the larger half of numbers.


Balancing ensures:





Max-Heap size ≥ Min-Heap...