Meta·Machine Learning Engineer·Technical Phone Screen
- A car starts at position 0 and needs to reach a destination `target` miles away. Gas stations are scattered along the route, each with a known position and fuel amount. The car begins with `startFuel` liters and consumes 1 liter per mile. You can stop at any station to take all its fuel. What is the minimum number of refueling stops needed to reach the destination, or -1 if it's impossible?
“I knew this was a greedy problem pretty quickly but fumbled the implementation for a bit.”