I dont understand the logic of this and in this what us prefix matrix sum.can h help me to understand completely
About th e submatrix
hello @manoj2597
first consider 1 d array instead of matrix.
and let say u want to find sum of elements between indices [i…j] .
then we can write this sum as->
sum(i,j) = sum(0,j) - sum(0,i-1) // i.e find sum from index [0 to j] and then subtract sum of [0 to i-1].
the difference will give sum(i,j).
and sum(0,j) or sum(0,i-1) is nothing but prefix sum.
so we can write
sum(i,j)=prefixsum[j]-prefixsum[i-1]
is this logic clear?
can u help me to understand it on google meet
sorry i cant.
i can take ur doubt here only
can you help me to understand it more clearly
u need to find sum of elements from index i to index j.
so first u can find the sum of first j element of array and them subtract sum of first i-1 elements . the resultant will be sum of [i…j].

from the yellow portion subtract red portion to get the required sum.
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.