Tesla Interview Question

Graph question based on Djikstras.