1.
Heap
2.
Kth Largest Element in an Array (Medium)
Given an integer array nums
and an integer k
, return the k
th largest element in the array.
Note that it is the k
th largest element in the sorted order, not the k
th distinct element.
Solve the problem without sorting.
3.
Find K Pairs with Smallest Sums (Medium)
You are given two integer arrays nums1
and nums2
sorted in non-decreasing order and an integer k
.
Define a pair (u, v)
which consists of one element from the first array and one element from the second array.
Assume k <= nums1.length * nums2.length
.
Return the k
pairs (u1, v1), (u2, v2), ..., (uk, vk)
with the smallest sums.