Exercises/#45 Dijkstra's Shortest Path
#45

Dijkstra's Shortest Path

MediumπŸ•ΈοΈ Graphs
100 XP

Problem

Given a weighted directed graph and a source node, find the shortest distance from source to all other nodes.

Examples

Input: graph = {0: [(1,4),(2,1)], 1: [(3,1)], 2: [(1,2),(3,5)], 3: []}, src=0
Output: {0:0, 1:3, 2:1, 3:4}
graphdijkstrashortest-pathheap
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

45 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features