Specially in the 2d grid problems, what should be the best way to recognize whether to apply BFS or DFS ?