• + 0 comments

    Python Solution:

    def minimumLoss(price):
        arr = sorted(enumerate(price), key=lambda x: x[1], reverse=True)
        diff = [arr[i][1] - arr[i + 1][1] for i in range(len(arr) - 1) if arr[i][0] < arr[i + 1][0]]
        return max(min(diff), 0)