Salesforce OA | Minimum Difference: Closest Pairs in a 1D Array
Salesforce · Question · Posted Apr 2026
Problem Statement: Minimum Difference The Objective: Given a set of distinct measurements taken at different times, find the minimum possible absolute difference between any two measurements. Print all pairs of measurements that share this minimum difference. Formatting Rules: Pair Order: For a pair (a,b), print them such that a<b. List Order: Print the pairs in ascending order. If multiple pairs (i,j) exist, they should be ordered ascending first by i and then by j. Output: Each pair should have a ...
The full answer & interview discussion are available to premium members.
Log in Create a free account