Given a network of n nodes and a list of directed, weighted edges (travel times), along with a source node k, return the time for a signal starting at k to reach every node; return -1 if some node is unreachable.
times = [[2,1,1],[2,3,1],[3,4,1]], n = 4, k = 22Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →Beyond basic traversal, some graph problems need ordering constraints (topological sort) or weighted shortest paths (Dijkstra, Bellman-Ford, minimum spanning trees).
Read the full Advanced Graphs guide →
Original problem on LeetCode ↗