Expand the pond

I am not able to find solution for this problem.Could you please provide some hint to get started

Hey Rishabh,
Just think of filling up one of the dry holes and proceeding. Once you fill up one dry hole, focus on getting the number of cells which can be reached from that. The maximum of them + 1 among all such possible ways will be your answer.

1 Like

I have used your approach to build my solution and it worked perfectly fine for two test cases but it’s showing run error for few cases. Can you please help me what I’m doing wrong?
https://ide.codingblocks.com/s/111053