Given a directed graph, find the maximum amount of "prize" (weight of edges) possible to be obtained.
Dynamic Programming Solution
- Check for infinite cycle (positive cycle)
- Negate edges and run Bellman-Ford
- Bellman-Ford finds negative weight cycles.
Optimal Substructure
The solution for
Subproblems
If