Minimum Absolute Difference in an Array

  • + 0 comments
    #python
    def minimumAbsoluteDifference(arr):
        arr.sort()
        m=1000000
        for i in range(len(arr)-1):
            d=abs(arr[i]-arr[i+1])
            if d<m:
                m=d
        return m