TLE in 4 test cases in question - Expand the pond

Please check my code: https://ide.codingblocks.com/s/281608

Let me check the problem I do not see any small mistake.

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.

I couldn’t find any error.Try by using bfs instead of dfs.
Maybe recursion call stack is taking more time than what is required.