arr
.minPairDiff
to a large number and an empty list result
to store the pairs.currPairDiff
.currPairDiff
is less than minPairDiff
, update minPairDiff
and reset result
to only contain the current pair.currPairDiff
is equal to minPairDiff
, append the current pair to result
.result
list containing all pairs with the minimum absolute difference.