Challenge: Car Fueling
Solve the Car Fueling Problem.
We'll cover the following
Problem
Car Fueling Problem
Compute the minimum number of gas tank refills to get from one city to another.
Input: Integers and , as well as a sequence of integers:
.
Output: The minimum number of refills to get from one city
to another if a car can travel at most miles on a full tank.
The distance between the cities is miles, and there are gas
stations at distances along the way. We
assume that a car starts with a full tank.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.