Editorial Solution


Can somebody explain the editorial solution?


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


@plak4 how is left pointer been increased?