FastPrepMinimum Absolute Difference Pairs
Problems/Minimum Absolute Difference Pairs

Minimum Absolute Difference Pairs

Akuna Capital logoAkuna Capital● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Our version is about 99% the same as the reported question.

You are given an array latencies of n distinct integers representing API response times.

Your objective is to identify all pairs of response times such that:

  • The absolute difference between the two values is the smallest possible among all pairs in the array.
  • Within each pair, the first value is smaller than the second.
  • The final list of pairs is sorted in ascending order based on the values.

Return all such pairs.

Function

minimumAbsoluteDifferencePairs(latencies: int[]) → int[][]

Examples

Example 1

latencies = [6, 2, 4, 10]return = [[2, 4], [4, 6]]

Input: n = 4, latencies = [6, 2, 4, 10]

Output: [[2, 4], [4, 6]]

Explanation: The minimal absolute difference is 2, and the pairs with that difference are (2,4) and (4,6). Within the pairs, the elements are ordered, and then the pairs themselves are in ascending order.

Example 2

latencies = [4, -2, -1, 3]return = [[-2, -1], [3, 4]]

Input: n = 4, latencies = [4, -2, -1, 3]

Output: [[-2, -1], [3, 4]]

The minimal absolute difference is 1, and the pairs with that difference are (-2, -1) and (3, 4).

Constraints

  • 2 ≤ n ≤ 10^5
  • -2 × 10^6 ≤ latencies[i] ≤ 2 × 10^6
  • The latencies array contains no duplicate elements.
  • Test Case Input Format
    • The first line contains an integer n, the size of the latencies array.
    • Each of the next n lines contains an integer, latencies[i].

More Akuna Capital Online Assessment questions

  • Delivery Management SystemOA · Seen Nov 2026
  • Count Server ReplacementsOA · Seen Nov 2026
  • Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximum Remaining Drone PowerOA · Seen Nov 2026
  • Rolling MetricsOA · Seen Oct 2026
  • Vowel Substring GameOA · Seen Sep 2026
  • Competitive ForagingOA · Seen Sep 2026
  • Binary CircuitOA · Seen Sep 2026
  • Items SortOA · Seen Sep 2026
  • Minimize Malware Spread by Removing a NodeOA · Seen Sep 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

Akuna Capital interview experiences

  • Akuna Capital Quant Trader and QR Interviews: 5 Experiences
  • Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
  • Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
  • Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
  • Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
  • Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)
All Akuna Capital interview questionsSee Akuna Capital hiring insights
Saved
class Solution {
    public int[][] minimumAbsoluteDifferencePairs(int[] latencies) {
      // write your code here
    }
}
Checking account…