Minimum Absolute Difference in an Array

  • + 2 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))])