Gas tank capacity: 20 Gallons
Test case
Initially no gas in the tank
Station Si |
Pi: Gas price per gallon at station Si |
Gi: Number of gallons needed to go from Si to Si+1 |
S0 |
$3 |
5 |
S1 |
$2 |
3 |
S2 |
$1 |
6 |
S3 |
$4 |
4 |
S4 |
$1 |
5 |
S5 |
$3 |
8 |
S6 |
$2 |
13 |
S7 |
$1 |
2 |
S8 |
$3 |
1 |
S9 |
$2 |
5 |
S10 |
|
|