Bus Assignment
Last updated
Last updated
use two variables cur
(the current number of passengers on the bus) and max
(the maximum number of passengers on the bus).
Every time you arrived at a bus stop, update the cur
based on the number of passengers get on and off. After that, compare cur
with max
, if cur
is bigger, then max=cur
.
As the first I tried, this question is not that hard. Basically, the idea is: