Final Challenge #2
Lesson 9 of 9 in Coddy's Bellman-Ford Algorithm - Graph Algorithms course.
Challenge
MediumOne more challenge: a point-to-point query with negative edges.
Write a function named shortestDistance that takes n, the flat edges array (triples, directed, possibly negative), a source, and a target, and returns the shortest distance from source to target, or -1 if target is unreachable. Assume no negative cycle.
Try it yourself
#include <stdlib.h>
int shortestDistance(int n, int* edges, int edges_size, int source, int target) {
// Write code here
return -1;
}