Minimum Refueling Stops
Updated
Problem statement
A car starts at position 0 with startFuel units of fuel and must reach position target. It consumes one unit of fuel per unit of distance.
Each station is [position, fuel]. On reaching a station, the car may stop once and take all of that station's fuel, or skip it. Return the minimum number of stops needed to reach target, or -1 if the target is unreachable.
For this exercise, station positions are distinct and strictly between 0 and target. The input may be unsorted and may be normalized into increasing position order.
Function
minRefuelStops(target: int, startFuel: int, stations: int[][]) → intExamples
Example 1
target = 100startFuel = 10stations = [[10,60],[20,30],[30,30],[60,40]]return = 2Stop at positions 10 and 60. Their fuel is sufficient to reach the target in two stops.
Example 2
target = 100startFuel = 1stations = [[10,100]]return = -1The car cannot reach the station at position 10, so no stop is possible.
Constraints
1 <= target <= 10^90 <= startFuel <= 10^90 <= stations.length <= 2 * 10^5- Each station is
[position, fuel], with distinctpositionstrictly between0andtarget. 1 <= fuel <= 10^9.
More Bloomberg LP Phone Screen questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- IPOTekion · PHONE SCREENTekion interview questions
- IPOInMobi · PHONE SCREENInMobi interview questions
- Lexicographically Smallest Array with K-Limited Right MovesGoogle · PHONE SCREENGoogle interview questions
- Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
- Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
- Schedule Unit-Time Jobs for the Most ProfitScale AI · PHONE SCREENScale AI interview questions
- Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions
- Minimum Refueling StopsUber · ONSITE INTERVIEWUber interview questions
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)