Sum of all submatrix approch 1 code

i understand the logic but my code couldnot give the correct output .
please, send me code with expanation…

Hey could you provide me your code so that I can tell you what is your mistake, in that way you would learn more.

Also the video describes a O(n^6) approach, you can do this in O(N^2), for that try to find in how many rectangle a given element is present.

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.