Minimum Absolute Distance
Given an array of integers, write a function min_distance
to calculate the minimum absolute distance between two elements then return all pairs having that absolute difference.
Note: Make sure to print the pairs in ascending order.
Example:
Input:
v = [3, 12, 126, 44, 52, 57, 144, 61, 68, 72, 122]
Output:
def min_distance(V) ->
min = 4
[(57, 61), (68, 72), (22, 126)]
Next question: Prime Music Integration.....
Loading editor