Given two sorted arrays, return the k pairs with the smallest sums. To make the output deterministic, sort pairs by sum ascending, then by the first value ascending, then by the second value ascending.
nums1 and nums2 are sorted arrays, k is number of pairs to return
k pairs with the smallest sums in deterministic order
Example 1:
Input:
nums1 = [1,7,11] nums2 = [2,4,6] k = 3
Output:
[[1,2],[1,4],[1,6]]
Explanation:
The three smallest sums all use 1 from nums1.
Example 2:
Input:
nums1 = [1,1,2] nums2 = [1,2,3] k = 2
Output:
[[1,1],[1,1]]
Explanation:
The smallest sum pair appears twice because nums1 contains duplicate 1s.