mini and maxi to store the indices of the minimum and maximum values in the prefix of the array.indexDifference.mini and maxi if the current value at i - indexDifference is less than or greater than the values at mini and maxi, respectively.valueDifference with the values at mini or maxi.[mini, i] or [maxi, i].[-1, -1].