Databricks interview question

Leetcode medium - hard level, some shortest path question