You are viewing a single comment's thread. Return to all comments →
Python 3
result = math.inf arr.sort() for i in range(len(arr) - 1): result = min(result, abs(arr[i] - arr[i + 1])) return result
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Absolute Difference in an Array
You are viewing a single comment's thread. Return to all comments →
Python 3