Databricks Interview Question

Graph Problem, Solved using standard Graph algos.