You are viewing a single comment's thread. Return to all comments →
Python: My short solution…
def flatlandSpaceStations(n, c): return max( (s := sorted(c))[0], # dist.: 0 to 1st spaceport n - s[-1] - 1, # dist.: last spaceport to n *map(lambda i: (s[i + 1] - s[i]) // 2, # dist.: halfway between- range(len(s) - 1))) # -each spaceport
I updated my code to make it more readable. Functional solutions aren't always difficult to read.
Seems like cookies are disabled on this browser, please enable them to open this website
Flatland Space Stations
You are viewing a single comment's thread. Return to all comments →
Python: My short solution…
I updated my code to make it more readable. Functional solutions aren't always difficult to read.