Implement Prototype(n int,edges [][3]int) ([][]*int,error) by Bellman–Ford from each source; Solve uses Floyd–Warshall O(V³) time and O(V²) memory. Directed signed edges; keep cheapest parallel edge. Return n×n distance matrix with nil unreachable and pointer zero diagonal if no negative cycle. n=0 returns nonnil empty. Error for negative n, invalid endpoints, or any negative cycle. Preserve input.

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…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.