$ Sum Of All Submatrix From A given Matrix - Approach 2

this question is hard please explain the process in detail

question:- https://online.codingblocks.com/app/player/189104/content/180055/6687/lecture

hello @dasvishal60

this approch make use of prefix sum array.
ie
prefix[i][j] = sum of elements of submatrix whose top left corner (0,0) and bottom right corner is (i,j)
for example
ss

if i talk about this array then here prefix[2][2] will tell me the sum of matrix whose upper left top index is (0,0) and bottom right index is (2,2).

in this case it is 54.

so now try to think , how u can genrate such matrix from given matrix?

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.