• + 0 comments

    Here is my Python solution!

    def flatlandSpaceStations(n, c):
        c = sorted(c)
        distances = []
        if n == 1:
            return 0
        if len(c) == 1:
            return max(c[0], n - c[0] - 1)
        for city in range(len(c)):
            print(city)
            if city == 0:
                distances.append(c[city])
            elif city == len(c) - 1:
                distances.append(n - c[city] - 1)
                break
            distances.append(abs(c[city] - c[city + 1]) // 2)
        return max(distances)