Find latency pairs with minimal difference
TeslaSoftware Engineer · Technical ScreenLast 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.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.