while solving this question I can not visualize ho this part actually work
f(x) = f(x — 1) + (no. of element <= x) — (no. of element > x)
using this idea then we apply sliding window to find the answer.
Need some clarity or better editorial for this question.