Closest Number Pairs
Updated
Problem statement
Given an integer array numbers, find the minimum absolute difference between any two values.
Return every pair that has this minimum difference as a two-dimensional integer array. Within each pair, place the smaller value first. Order the returned pairs by their first value in ascending order.
Function
closestNumberPairs(numbers: int[]) → int[][]Examples
Example 1
numbers = [4,2,1,3]return = [[1,2],[2,3],[3,4]]After sorting, the array is [1,2,3,4]. Every adjacent difference is 1, so all three adjacent pairs are returned.
Example 2
numbers = [-10,-3,0,5]return = [[-3,0]]The sorted adjacent differences are 7, 3, and 5. Only [-3,0] has the minimum difference.
Example 3
numbers = [6,2,4,10]return = [[2,4],[4,6]]Sorting gives [2,4,6,10]. The adjacent differences are 2, 2, and 4. The smallest difference is 2, so return [[2,4],[4,6]].
Constraints
2 <= numbers.length <= 10^5.-10^9 <= numbers[i] <= 10^9.- All values in
numbersare distinct.
Source note: These English source panels preserve the temperature task and examples from the January 14 Adobe OA report.
More Adobe Online Assessment questions
- Base Unit ConversionsOA · Seen Nov 2026
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Top-Funded Villages and ProjectsOA · Seen Aug 2026
- Count Parent Nodes With a Target SumOA · Seen Aug 2026
- Largest Binary Number by ConcatenationOA · Seen Aug 2026
- Count Events by CategoryOA · Seen Aug 2026
- Graph M-ColoringOA · Seen Aug 2026
- Hall of Shifting TilesOA · Seen Aug 2026
- K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
- Maze ReachabilityOA · Seen Aug 2026
Similar questions at other companies
- Build the Task HierarchyPendo · OA
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
- Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
- Rank Football TeamsCapital One · OACapital One interview questions
- Maximum Apples That Fit in a BoxVirtu Financial · OAVirtu Financial interview questions
- Rank Football TeamsPersona · OAPersona interview questions
- Meandering ArrayVerisk · OA
- Minimum Magic Stones After MergesElevenLabs · OAElevenLabs interview questions
Adobe interview experiences
- Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
- Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
- Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
- Adobe New Grad MTS Interview Questions: 7 Experiences
- Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)