Spread the Tents
spots lists the places along a path where a tent can stand. They are all different and in no particular order. Put up tents tents, each on its own spot, so that the two tents closest to each other are as far apart as possible.
Return that distance.
Example 1
spots [1,2,4,8,9]
tents 3
returns 3
Tents at 1, 4 and 8 are at least 3 apart. No three spots are all at least 4 apart.
Example 2
spots [10,0]
tents 2
returns 10
Both spots are used, and they are 10 apart.
Constraints
2 <= tents <= len(spots) <= 3000 <= spots[i] <= 10**9, all different
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.