Amazon loves problems where you must efficiently pick the "most" or "least" important items from a collection.

Instead of sorting everything (O(n log n)), we can use a heap/priority queue to maintain only the top K items in O(n log k).







🔑 Where Amazon Uses This Pattern



Finding Kth largest/smallest numbers
Getting Top K frequent...