Katkat

Find latency pairs with minimal difference

TeslaSoftware Engineer · Technical Screen

Last updated

This question evaluates array manipulation, pairwise comparison, and algorithmic efficiency by requiring identification of minimal absolute differences and construction of ordered latency pairs.

Given an array of integers representing network latencies, return all increasing pairs [a, b] such that b − a equals the minimal absolute difference between any two elements in the array. Return the pairs sorted by a then b. State the time and space complexity of your approach.