Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Minimise Maximum Distance To Go To Gas Station

Difficulty: Medium

Acceptance: 64.00%

Points: 30.00

You are given a sorted array stations[] representing the positions of existing gas stations on a number line, and an integer k representing the number of additional gas stations you can add. Your task is to add exactly k new gas stations anywhere on the number line such that the maximum distance between any two adjacent gas stations is minimized. Return the minimized maximum distance.

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 2 = stations.length = 105
  • 0 = stations[i] = 10?
  • 0 = k = 105
  • stations is sorted in ascending order
Companies:
Apple
Topics:
Binary Search
Locked Content
Access Restricted: Please Login to access the code editor and test cases.