Number of subarrays with range less than k
This might help you Starting with i,j = 0, we could iterate j, keeping
track of min and max. When the range becomes >= k via raising max, we need
to find a new i where min(s[i..j]) > max - k (analog for the other case).
Obviously we could find this i
Date : November 17 2020, 03:01 PM , By : Daria Tereshkina