Yeah that makes sense. I initially thought you meant that we can do it using a linear scan or something. silly me -_-;
@meooow’s solution with two pointers instead of binary search (for counting subarrays with sum <=x) will be faster, for Q=20. That might have been the intended solution.