Final Challenge #2
Lesson 9 of 9 in Coddy's Topological Sort - Graph Algorithms course.
Challenge
MediumOne more challenge, using the topological order.
Write a function named longestPath that takes n and the flat edges array of a DAG (directed, acyclic), and returns the number of edges on the longest path in the graph.
For example, on a chain 0->1->2->3 the longest path has 3 edges.
Try it yourself
#include <stdlib.h>
int longestPath(int n, int* edges, int edges_size) {
// Write code here
return 0;
}