3 out of 6 test cases are failing

I am storing the size of connected cells and then checking for each dry cell, if I fill that cell then calculating the size of the resultant component. Please check what’s wrong with my approach or code.

hello @aakash47

pls save ur updated code here-> https://ide.codingblocks.com/
and share its link with me.

a) in line 38 it should be j<m

b) ur grouping method is not correct.
it will assign more than one group id to same group.

example->

0 0 0 1
0 0 1 1
these two 1’s have different group id as per ur logic.

refer this code->

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.