stations in increasing order. You must build extra more stations at any points of the highway, not necessarily at integer positions.
Afterwards, look at the longest gap between two neighboring stations. Return the smallest possible length of that gap.
Answers within 10⁻⁶ of the exact value are accepted.stations=[0, 10, 12], extra=4 → 1.9999994549380062
Four new stations cut the gap of length 10 into 5 pieces of 2, and the gap from 10 to 12 is already 2 long. The longest gap is 2.
stations=[3, 4, 10], extra=1 → 2.9999995376783772
The single new station goes in the middle of the gap from 4 to 10, at 7: the gaps become 1, 3 and 3.
stations=[0, 7, 9, 20], extra=2 → 5.499999389257937
stations is strictly increasingstations=[0, 10, 12], extra=4
1.9999994549380062
Run checks the first 3 tests in your browser. Submit checks all 96 tests on the server, hidden ones included.