Aggressive cows

Write codeMedium24 min

Your task

Given positions of n stalls on a number line (array stalls) and an integer c, place c cows in distinct stalls so that the minimum distance between any two cows is as large as possible. Return that maximized minimum distance. 2 <= c <= len(stalls) <= 1e5.

Examples

max_min_cow_distance(stalls: list[int], c: int) -> int
Example 1
Inputmax_min_cow_distance([1, 2, 8, 4, 9], 3)
Output3