Your question is Shortest Path in Weighted Graph. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a weighted directed graph with n nodes labeled from 0 to n - 1, an edge list edges where each element is [u, v, w], a source node src, and a destination node dst, return the length of the shortest path from src to dst. If no path exists, return -1. All edge weights are non-negative integers.
def shortest_path(n, edges, src, dst):