Hey, this is awesome solution, thanks for posting. The MOST crucial part of your solution is to not remove visited coordinates in DFS and reuse the visited set in BFS. Wanted to explain your viewers - its importance in your approach. This is because the visited set kinda guides the BFS algorithm - what cells can be visited and what are not. Like, it'll help you to not add a location with obstacle and etc. If a location is in the visited set after DFS - it is a good location. And that set is why this approach works. cheers.
Hey, this is awesome solution, thanks for posting.
The MOST crucial part of your solution is to not remove visited coordinates in DFS and reuse the visited set in BFS. Wanted to explain your viewers - its importance in your approach.
This is because the visited set kinda guides the BFS algorithm - what cells can be visited and what are not. Like, it'll help you to not add a location with obstacle and etc.
If a location is in the visited set after DFS - it is a good location.
And that set is why this approach works.
cheers.
Thanks for doing this problem. Can you please do 'Remove Sub-Folders from the Filesystem (LC 1233)'?
thank you!
hi you didnt explain why we need backtracking is it to get back to the starting position?
Is there a reason to pick this problem? - This requires premium leetcode subscription.
Awesome solution. Would be great if you can help understand how are we assuming 0,0 as source