Gas Station Problem
0 Answers
Gas Station Problem
| Flag | PURGE
We have a car that can travel distance D on the full tank, and a route of length L, with gas stations numbered 1 to n, and station i is in distance di from the start, d1 = 0. The gas at station i has price pi, which means that travelling one unit of distance with the gas purchased at that station has the cost of pi.
We need to decide at which stations to stop (including station 1 where we are stopped at the beginning) at how much gas to purchase at those station, so the cost of reaching the end of the route will be minimal.
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.