Databricks interview question

Shortest Path problem with BFS