Can somebody explain the editorial solution?
Editorial Solution
plak4
#2
we do exactly what the problem asks ie for every interval we find if diff of max and min is less than B. To find the min and max of the interval quickly we use a set. If condition holds true then we increase the right pointer, else we try to increase the left pointer