Browse and switch challenges
Single-Source Shortest Paths
Return shortest distances from source s
to all nodes in a directed graph with non-negative edge weights; use null
for unreachable nodes.
Important
- -Node indices are in
0..n-1
. - -Edge weights are non-negative.
Signature
Constraints
- -
1 ≤ n ≤ 2e5
- -
0 ≤ w ≤ 1e9
- -
|edges| ≤ 2e5
Examples
System prompt
0 tokens
Read-only
// Waiting for generated code…
// Your output will appear here as soon as the model returns JavaScript.
// It must define function dijkstra(…)
.
// Tip: write a prompt on the left and click "Generate code" .
0 tokens
Submission #1
0tokens(0/0)
Leaderboard
Loading leaderboard...