Problem
There are baskets at the positions in position (not necessarily sorted). You must place m balls into distinct baskets so that the minimum distance between any two balls is as large as possible. Return that largest possible minimum distance.
Example 1
- Input
- position = [1, 2, 3, 4, 7], m = 3
- Output
- 3
- Why
- balls at 1, 4, 7
Example 2
- Input
- position = [5, 4, 3, 2, 1, 1000000000], m = 2
- Output
- 999999999
Example 3
- Input
- position = [1, 2], m = 2
- Output
- 1
Constraints
2 <= position.length <= 10^51 <= position[i] <= 10^9All values in position are distinct.2 <= m <= position.length