Last Stone Weight — LeetCode 1046 Max-Heap Simulation
Solve LeetCode 1046 Last Stone Weight, a classic Amazon and Google warmup that teaches max-heap simulation by repeatedly smashing the two heaviest stones.
1582 articles
Solve LeetCode 1046 Last Stone Weight, a classic Amazon and Google warmup that teaches max-heap simulation by repeatedly smashing the two heaviest stones.
Solve LeetCode 506 Relative Ranks by assigning Olympic-style medals using a max-heap or index-sort, a common Amazon and Google warmup question.
Solve LeetCode 658 Find K Closest Elements using a max-heap of size K or O(log n) binary search on the window boundary, a classic Google and Amazon question.
Solve LeetCode 215 Kth Largest Element using a heap (O(n log k)) or Quickselect (average O(n)). One of the most-asked Meta and Amazon interview problems.
Solve LeetCode 347 Top K Frequent Elements using a min-heap (O(n log k)) or bucket sort (O(n)). One of the most common Meta and Amazon onsite questions.