is my code id.
Please sir tell the mistake in the code.
why ans is not getting updated to the correct value…
Code of expand the pond is not working correctly
@Adarshrajpandey It is because you are not sending the visited array by reference. Rather you are sending a copy of the visited array each time. Use & in front of the array to send it by reference.
code is not getting submitted
on clicking submitt button it is showing nothing
@Adarshrajpandey
3 mistakes
- You’re applying DFS at each empty cell, complexity becomes n^2 it should be n where n = r*c
- You sent bool visit array by copy, instead declare it as a global variable
- You are not resetting values to 0 after setting to 1 before DFS
See this link for code and instructions Expand the pond