Amazon Interview Question

All pairs shortest path problem.