https://ide.geeksforgeeks.org/2nusIVzSff
Please have a look at the code,.
Thanks
Hi Gagan, try to run your code for the following testcase https://cb.lk/1UzGC. It gives No output for this case.
But why is it so ? What’s wrong in the code or logic ? I am not able to figure out where I would get a run time error .
Please help , and correct my code if possible so that I can have a clear view of what is wrong with my code.
Thanks
Gagan ur logic is correct no problem in that may be TLE coming due to the Valid function as for all case u are calling the function and checking the validness of the point u r moving instead of that just make a if condition inside the dfs function to check so it will take less time instead of calling the function. Otherwise ur code is write