What is the error in the code?

sir,

I tried this code with approach 2 but by taking bi and bj constant as the max sum submatrix is always going to lower one in a sorted 2 -D array.

hello @gargshivam2001 please wait i will go through your code .could you please share the hackerblocks link of this question so that i can try submit this and see question as well .

it is problem of max sum submatrix of launchpad course in topic 2-D array problem lecture 2 and 6

please share the screenshot of the question.
as i dont have acess tonyour course .

@gargshivam2001 okay wait

@tusharaggarwal272
please reply sir

hey @gargshivam2001 i am sorry there was some network issue thats why i was not able to reply before .
the code which you have shared does not seem of the max sum submatrix in the given sorted row and column.
and also for this question the approach which they have discussed is very simple and efficient .
if you still have any doubt you can ask here.

what is the issue in my approach sir ??

hey @gargshivam2001 the link which you have shared contains the code of searching in the 2d array .
please see that link .

sir i have updated the link
please check

hey @gargshivam2001 you code is producing the wrong output.


see this,
the output should be 19 but it is producing 119 .

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.