← Questions
Shortest subarray whose max minus min is at least K
0
I was asked this
No reports yet. Sign in to say where you were asked it.
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 official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
