Sum of all Submatrices from A given Matrix Approach 3

I am not able to understand the approach from this video. I have watched the video twice but still I am not able to understand the concept.

@avijuneja2007 I would suggest you to watch the video again and in the proper sequence. Try to dry run the code on your own to understand well. You can best understand from the video.
Refer this if this can help.

How come the Total number of submatrices that can be made = x*y

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.