FastPrepFind K Pairs with Smallest Sums
Problems/Find K Pairs with Smallest Sums

Find K Pairs with Smallest Sums

Amazon logoAmazon● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Amazon full-time phone screen. The named problem gives the main goal. We set the input limits and a fixed order for the results. Our version is about 98% the same as the reported question.

Given two integer arrays nums1 and nums2, both sorted in nondecreasing order, consider every index pair (i, j) and the pair [nums1[i], nums2[j]].

Return the k pairs with the smallest sums. Return them in nondecreasing order of their sums. Pairs with equal sums are ordered by i, then by j. Different index pairs are distinct, so duplicate value pairs may appear.

Function

kSmallestPairs(nums1: int[], nums2: int[], k: int) → List<List<Integer>>

Examples

Example 1

nums1 = [1,7,11]nums2 = [2,4,6]k = 3return = [[1,2],[1,4],[1,6]]

The three smallest pair sums are 3, 5, and 7.

Example 2

nums1 = [1,1,2]nums2 = [1,2,3]k = 2return = [[1,1],[1,1]]

The two occurrences use different indices in nums1.

Constraints

  • 1 <= nums1.length, nums2.length <= 100000.
  • Both arrays are sorted in nondecreasing order.
  • Every value is in [-10^9, 10^9].
  • 1 <= k <= 10^4 and k <= nums1.length * nums2.length.
  • Every pair sum fits in a signed 32-bit integer.

Source note: Author-written prompt excerpt retained for source fidelity.

More Amazon Phone Screen questions

  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Search in a Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Second Largest Distinct ElementPHONE SCREEN · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Select the Top User MatchesDuolingo · PHONE SCREENDuolingo interview questions
  • Meeting Rooms IIQuince · PHONE SCREENQuince interview questions
  • Kth Largest Element in an ArrayLinkedIn · PHONE SCREENLinkedIn interview questions
  • Meeting Rooms IISecuronix · PHONE SCREEN
  • Merge Multiple Sorted StreamsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
See Amazon hiring insights
Saved
class Solution {
    public List<List<Integer>> kSmallestPairs(int[] nums1, int[] nums2, int k) {
        // Write your code here.
    }
}
Checking account…