Data Structures & AlgorithmsModerateICPC regional · shortest paths

Problem: Which problem is solved by the Floyd-Warshall algorithm in the presence of negative edges but no negative cycle?

  1. A. Minimum spanning tree
  2. B. Maximum bipartite matching
  3. C. All-pairs shortest paths
  4. D. Longest increasing subsequence

Correct answer: C. All-pairs shortest paths

The triple loop handles negative edges correctly as long as no negative cycle exists.

More Coding Interview Problems questions

Exams that ask this topic