I dont understand this approach?

i think here vertical submatrix will not be counted

My problem is that suppose there is 2x2 matrix ans all the elements are 1 ,

then top left can be only (0,0) and bottom right is (1,1) the sum will be 1+1+1+1=4 where as it should be 16

start the inner two from i and j it will work

1 Like

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.