You are viewing a single comment's thread. Return to all comments →
def flatlandSpaceStations(n, m, c): if n == m: return 0 c = sorted(c) start_distance = c[0] end_distance = (n-1) - c[-1] mid_distance = None for i in range(len(c)-1): gap = c[i+1] - c[i] distance = gap // 2 if mid_distance is None or distance > mid_distance: mid_distance = distance return max(start_distance, mid_distance or 0, end_distance)
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 →