Heap / Priority Queue
9 animated solutionsAlways know the current smallest or largest element. The pattern behind Top-K questions, streaming medians and merging k sorted lists. Every problem below plays as an animated walkthrough with solutions in Python, Java and C++. Companies that ask these most: Tinder, Meta, Adobe.