Back to course home
0% completed
Problem Challenge 1: K Pairs with Largest Sums (hard)
Problem Statement
Given two sorted arrays in descending order, find ‘K’ pairs with the largest sum where each pair consists of numbers from both the arrays.
Example 1:
Input: nums1=[9, 8, 2], nums2=[6, 3, 1], K=3
Output: [9, 3], [9, 6], [8, 6]
Explanation: These 3 pairs have the largest sum. No other pair has a sum larger than any of these.
Example 2:
Input: nums1=[5, 2, 1], nums2=[2, -1], K=3
Output: [5, 2], [5, -1], [2, 2]
Constraints:
- 1 <= nums1.length, nums2.length <= 10<sup>5</sup>
- -10<sup>9</sup> <= nums1[i], nums2[i] <= 10<sup>9</sup>
- `nums1
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible