Implement Prototype(n int,edges [][2]int,source int) ([]*int,error) by enumerating simple paths; Solve uses adjacency-list BFS in O(V+E). Undirected edges permit loops/duplicates. Return vertex-indexed hop counts, pointer zero at source and nil for unreachable. Error for n<=0, invalid source or endpoints. Preserve edges, including on error.
Edit exercise.go; retain the public types and signatures. prototype and final are separate stages. The executable tests recover panics as failures, report named checks, and exit nonzero on any failure. A successful run must execute at least one check. Tests use logical time or explicit synchronization where relevant.
Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
Loading editor…
No results yet.
Complete the starter code, then run the checks.
Results and errors will appear here.