Minimize Max Distance to Gas Station
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Gas stations sit on a number line at the strictly increasing integer positions in stations. You must add exactly k new stations, and each new station may go at **any real position**, not just integers.
After adding them, let penalty be the largest distance between two adjacent stations. Return the smallest possible penalty.
Answers within 10^-6 of the true value are accepted.
Examples
Constraints
- 2 <= stations.length <= 2000
- 0 <= stations[i] <= 10^8
- `stations` is strictly increasing
- 1 <= k <= 10^6
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.