Minimum Absolute Difference in an Array

  • + 0 comments

    def minimumAbsoluteDifference(arr):

    n_arr = []
    arr.sort()
    for i in range(len(arr) - 1):
        c = arr[i]
        n = arr[i + 1]
        d = abs(c - n)
        n_arr.append(d)
    return min(n_arr)