āš ļø Blockly failed to load. Check your internet connection and refresh.
Road Trip Fuel
Problem
You are driving through N towns along a highway. Between consecutive towns, the car uses fuel[i] litres of petrol to go from town i to town i+1.

You start with F litres in the tank. At any town you can stop and refuel, adding R litres to your tank.

Find the minimum number of refuelling stops needed to reach town N from town 1.

Greedy rule: only refuel when you don't have enough fuel to reach the next town!
Input Variables (pre-loaded)
šŸ’” Drag N, F, R, and fuel for segment i from Inputs.
Your Output
Result
—
Run your program to see the result.
Execution Log
Ready. Press ā–¶ Run to start.
Expected Answer
Answer:
?
Hint