I want to know how to solve this question

I am unable to think of algo for this question…

@kaushikjatin,
Hint 1: Try think of a Data Structure

Hint 2: BIT

Bro this question is in the challenges of BIT…so I was known to it that it will use BIT…but wasn’t able to form the algo…but I will try once again…and will tell am I able to formulate the algo or not…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Bro tried…but not able to formulate the algo…please explain the algo…

@kaushikjatin,
Make a 2d BIT, where BIT[i][j]=represents rectangle ({i-2^{d_i}+1,j-2^{d_j}+1}, {i,j}),
where, ({a,b},{c,d}) represents the upper left and bottom right corners of rectangle respectively.