Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
A car travels from a starting position to a destination which is `target` miles east of the starting position. There are gas stations along the way. The gas stations are represented as an array `stations` where `stations[i] = [positionᵢ, fuelᵢ]` indicates that the `i`-th gas station is `positionᵢ` miles east of the starting position and has `fuelᵢ` liters of gas. The car starts with an infinite tank of gas, which initially has `startFuel` liters of fuel in it. It uses one liter of gas per one mile that it drives. When the car reaches a gas station, it may stop and refuel, transferring all the gas from the station into the car. Return the minimum number of refueling stops the car must make in order to reach its destination. If it cannot reach the destination, return `-1`.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.