Sum of all possible submatrix approach 2 code

for

1 1

1 1
output 8 instead of 16
unable to debug…

Hello @bhattanurag426 this is the correct code:


Happy Learning!!

sir can you please explain this code why we have these if conditions in the main loop as it is not explained in the video tutorial. I would be grateful sir…

Hello @bhattanurag426 what was the code in the video have you written the same code?

yes sir i had written the same code but the output camed the e wrong but now the output is correct when I applied the code which you gave

yes sir i had written the same code but the output came the e wrong but now the output is correct when I applied the code which you gave

the code in the video does not have any if conditions

Hello @bhattanurag426 please see the video again and dry run your code then there you must be something you that youa re missing.
and if you dry run the code which i have corrected you will get to know and you will remember that for your lifetime.

Thank you sir , I got it.

Hey @bhattanurag426 if your doubt is cleared you can mark this doubt as resolved.
Happy Learning!!

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.