Error in code not found

i can’t find the error in this code…why isn’t it running?

Hi @tusharbhardwaj127,
try using 1 based indexing in dis problrm since in the end u r using arr[tp-1][td-1] and when tp=0, it will raise an error.
moreover brx>=tlx and similar for bry>=tly. so run for loop for the same at the end.
refer to d updated code.


Hope dis helps.

should i be using 1 based indexing always when the code tries to access out-of-bound index ? or is there any other way ?

@tusharbhardwaj127,
it is prefered.
but u can always use if else condition to avoid going out of bound.

i think there is some problem in the prefix array calculation…please let me know how to generate the prefix array.

no its fine. the loop was arranged opposite. thanks