Recerrence equation used

What should be the recerrecne equation That can be used ,if we go by 2D Dp??

Hi @Kapil-Israni-2501896056550976
You can use the following :
Construct an auxiliary sum matrix S[R][C] for the given M[R][C] with R|C be the number of Rows and
Columns.
1) Copy first row and first columns as it is from M[][] to S[][]
2) For other entries, use following expressions to construct S[][]
If M[i][j] is 1 then
S[i][j] = min(S[i][j-1], S[i-1][j], S[i-1][j-1]) + 1
Else If M[i][j] is 0
S[i][j] = 0
2) Print the maximum entry in S[R][C]

I hope this helps :slight_smile:
Please mark the thread Resolved if so.

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.

did you actually solved the problem using above approach