Recently, I came across this very beautiful problem which is also a very good use case of graph breadth first search algorithm.