Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 545 Bytes

File metadata and controls

12 lines (9 loc) · 545 Bytes

Problem 20: Dual-Stream Optimization

Problem Statement

You are given two integer arrays nums1 and nums2 sorted in ascending 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. Return the k pairs (u1, v1), (u2, v2), ..., (uk, vk) with the smallest sums.

Input Format

  • Two sorted integer arrays nums1 and nums2.
  • An integer k.

Example

Input: nums1 = [1, 7, 11], nums2 = [2, 4, 6], k = 3
Output: [[1, 2], [1, 4], [1, 6]]