Editorial Solution


#1

Can somebody explain the editorial solution?


#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


#3

@plak4 how is left pointer been increased?