Looking at the following hackerrank problem: https://www.hackerrank.com/challenges/flatland-space-stations
You are given a number n where cities can be at indices 0 to n-1 and also given an unsorted list of indices of cities where there are stations. The goal is to find the maximum distance from a city to a station. For example, for n=5 and the station list [0,4], the answer would be 2 since index 2 is 2 away from both 0 and 4 and all other stations at indices 0-4 are closer to one of 0 or 4.
I was looking for a short Python3 solution. The function body takes in the number n and a list c (like [0,4] in the example). After some revisions, I came up with the 69 character function body below:
c.sort();return max(t-s for s,t in zip([-c]+c,c+[2*n-c[-1]-1]))//2
Curious about whether anyone can come up with a shorter body.