You are viewing a single comment's thread. Return to all comments →
My solution in Python (Unfortunately it gets timed out on cases with 10000 elements in the list. Does anyone know how to fix this problem?):
from itertools import combinations return min ([abs(i-j) for i, j in list(combinations(arr, 2))])
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 →
My solution in Python (Unfortunately it gets timed out on cases with 10000 elements in the list. Does anyone know how to fix this problem?):