Doubt in question where Q queries given and we have to find sum of submatrix for all queries

In the procedure given in the video, we can only find sum of one submatrix at one time. So we have to write Q statements for Q queries (because loop will not work). So if the number of queries is large we cannot follow this procedure.

Hey @sahilkhan2312000131
Yes correct .

So it is not the best way to solve for n queries. What should we do to solve for n queries??

Such type of quesrtions are formulated to meet the complexity conditions.
So no of queries will always be limited in this question.

Hey @sahilkhan2312000131
If u dont have any other doubt in this then please mark it as resolved :slight_smile: