1. Given a list of connected pipes with different flow-capacities, find the amount of water that can go from a starting point to a given ending point.
2. You have a lot of cars that you want to take from city ‘s’ to city ‘t’. Each road between two cities has a limit on the number of cars that can go there. What is the maximum number of cars that you can take from ‘s’ to ‘t’?
The two above problems can be visualized in the following way:
In Problem 1, each letter represents a pipe, and each number represents the flow-capacity between two pipes. That is, maximum amount of water that can go from s to a is 11 units, a to b is 12 units and so on. …