Dijkstra Shortest Path

Given a directed weighted graph with n vertices numbered from 0 to n - 1, an edge list edges where each edge is [u, v, w] (a directed edge from u to v with non-negative integer weight w), and a source vertex src, return an array dist of length n where dist[i] is the length of a shortest path from src to i, or -1 when i is unreachable from src.

Because weights are non-negative, a shortest path never repeats a vertex and uses at most n - 1 edges. The same ordered pair may appear several times with different weights, in which case only the smallest weight can ever help. A self loop (u == v) is allowed and never shortens a distance. dist[src] is always 0.

Examples
Input: [5,[[0,1,2],[0,2,4],[1,2,1],[1,3,7],[2,4,3],[3,4,1]],0]
Output: [0,2,3,9,6]
Hints

Dijkstra Shortest Path

Given a directed weighted graph with `n` vertices numbered from `0` to `n - 1`, an edge list `edges` where each edge is `[u, v, w]` (a directed edge from `u` to `v` with non-negative integer weight `w`), and a source vertex `src`, return an array `dist` of length `n` where `dist[i]` is the length of a shortest path from `src` to `i`, or `-1` when `i` is unreachable from `src`.