Shortest subarray whose max minus min is at least K
Given an integer array and k, return the length of the shortest contiguous subarray in which the largest value minus the smallest value is at least k, or -1 if none exists. Aim for linear time.
No answer yet. Write the first one; the best answer gets endorsed.
