LeetCode 973: K Closest Points to Origin
A clear explanation of returning the k closest points to the origin using squared distance and sorting.
38 notes
A clear explanation of returning the k closest points to the origin using squared distance and sorting.
A clear explanation of counting reachable original and subdivided nodes using Dijkstra's shortest path algorithm.
A clear explanation of minimizing refueling stops using a greedy max heap over reachable stations.
A clear explanation of hiring exactly k workers with minimum total cost using wage-to-quality ratios, sorting, and a max heap.
A clear explanation of finding the kth smallest fraction from a sorted array using a min-heap.
A clear explanation of finding the minimum time to reach the bottom-right cell using a priority queue and minimax path reasoning.
A clear explanation of rearranging characters so no two adjacent characters are equal using a greedy max heap.
A clear explanation of maintaining the kth largest element in a stream using a fixed-size min heap.
Find the time needed for a signal to reach all nodes in a directed weighted graph using Dijkstra's algorithm.
Find the k most frequent words using frequency counting and custom sorting by count and lexicographical order.
A heap-based solution for finding the smallest range that contains at least one number from each sorted list.
A greedy heap solution for taking the maximum number of courses before their deadlines.
A clear explanation of maximizing capital by selecting at most k projects using sorting and a max heap.
A clear explanation of finding the shortest rolling-ball path to the hole using Dijkstra with lexicographic tie-breaking.
A clear explanation of maintaining the median of each fixed-size window using two heaps and lazy deletion.
A clear explanation of trapping rain water in a 2D elevation map using a min heap and boundary expansion.
A clear explanation of finding the k smallest pair sums from two sorted arrays using a min heap and best-first search.
A clear explanation of rearranging a string so equal characters are at least k positions apart using a heap and cooldown queue.
A clear explanation of implementing a simplified Twitter using hash maps, sets, timestamps, and a heap.
A clear explanation of Top K Frequent Elements using frequency counting and bucket sort.
A clear explanation of Super Ugly Number using dynamic programming with one pointer per prime.
A two-heap data structure for adding numbers from a stream and returning the current median in constant time.
A clear explanation of the Meeting Rooms II problem using a min heap to track active meeting end times.
A clear explanation of computing the skyline formed by buildings using sweep line and a max-heap.
A clear explanation of finding the kth largest element using sorting, a min-heap, and Quickselect.
A detailed explanation of merging k sorted linked lists using a min heap.
Binary, d-ary, Fibonacci, pairing, soft heaps, double-ended structures, tournament trees, and concurrent priority queue designs.
External sorting technique that uses a heap to produce initial sorted runs longer than the available memory.
Sort a k-sorted array using a sliding min heap window of size k+1.
Sort an array where every element is at most k positions away from its final sorted position.
Heapsort variant that uses a ternary heap with three children per node.
Heapsort variant that uses bottom up sift down to reduce comparisons during heapify.
Comparison sorting algorithm that builds a heap and repeatedly extracts the maximum.
Maintain the k-th largest value while values arrive one at a time.
Select the k-th smallest fraction formed by pairs from a sorted array using heap or binary search.
Maintain the k largest elements while values arrive one at a time.
Find the k largest or k smallest elements by maintaining a bounded heap.
Select the k-th smallest or largest element by maintaining a heap of candidate values.