DrawCode Practice Problem

Shortest Unweighted Path · Message events 20

Message events dataset, variant 20. Return the fewest edges from `source` to `target` in an undirected graph, or `-1` if unreachable. Implement `solve(n, edges, source, target)` and return the requested value.


Interactive Visualizer Workspace

Explore step-by-step interactive animations, memory state tracking, and live multi-language execution in DrawCode.

Launch Interactive Visualizer