You are given an array of integers stalls[] representing the positions of stalls on a number line and an integer k representing the number of cows. Your task is to place the cows in these stalls such that the minimum distance between any two cows is as large as possible. Each stall can hold only one cow. Return the maximum possible minimum distance between any two cows.
Topics
Companies
Articles
Examples:
N/A
Constraints:
2 = stalls.length = 105
1 = stalls[i] = 10?
2 = k = stalls.length
Companies:
Walmart
Topics:
Binary Search
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.
Access Restricted: Please Login to access the code editor and test cases.