what is bi=li+1 any why ???
At 7:30 what is bi=li+1 any why?
@premang
that is wrong it should be bi=li.
let me explain you approach
assuming we have N x M matrix
first we choose top left corner (i,j)
then we choose bottom right corner (bi,bj)
now we find sum of this considered submatrix.
for(int i = 0 ; i <= N-1 ; i++) {
for(int j = 0 ; j <= M-1 ; j++ ) {
for(int bi = i ; bi <= N-1 ; bi++) {
for(int bj = j ; bj <= M-1; bj++) {
// here (i,j) is coordinate of ur top left corner
// (bi,bj) is coordinate of bottom right corner
// compute sum of considered submatrix
}
}
}
}
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.