🌊 Flow of Giants

Keep top K elements with a min-heap — Kth largest rises to surface!

K = Add Number:
🌊 Stream (All numbers seen)
Empty stream...
🏔️ Min-Heap (Size K)
Empty heap...
K Value
3
Heap Size
0
Kth Largest
-
Set K and add numbers to the stream
Min-Heap Strategy: Keep only K elements in heap. When adding a new element: if heap.size < K → push; else if num > heap.min → pop min, push new. The min of heap is always the Kth largest!