Find K Pairs with Smallest Sums
We'll cover the following
Statement
Given two arrays and an integer , find pairs of numbers with the smallest sum so that in each pair, each array contributes one number to the pair.
Constraints:
-
list1.length
,list2.length
-
list1[i]
,list2[i]
-
-
Input lists should be sorted in ascending order.
-
If the value of exceeds the total number of valid pairs that may be formed, return all the pairs.
Example
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy