can we use bfs here?
how to use when some point are isloated?
can we use bfs here?
how to use when some point are isloated?
@pathak1899 this question is titled BFS, so you can safely assume that BFS will work here. And if a point cannot be reached you have to print -1.