• + 0 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.