Algorithm · Glean · Hard
Suppose you are given two integer arrays a and b, both sorted in non-decreasing order, along with an integer k. From the multiset formed by all values in a and b, identify the k-th largest value; rank 1 is the maximum value. Repeated values are counted individually, so each occurrence contributes to the ranking. Example 1: Explanation: The combined descending order is [12,10,9,8,6,4,3,2,1], so the 4th largest element is 8. Example 2: Explanation: The combined descending…
Checking your access…