dsa7 min read
Floyd-Warshall — All-Pairs Shortest Path in O(V^3) [LC 1334, Google, Amazon]
Master the Floyd-Warshall algorithm: a triple-nested DP that computes shortest paths between every pair of vertices in O(V^3), supports negative edges, and detects negative cycles. The interview workhorse for dense graphs and small V, asked at Google, Amazon, and Microsoft.
Read →