You are viewing a single comment's thread. Return to all comments →
from bisect import bisect def flatlandSpaceStations(n, c): c.sort() max_dist = 0 for city in range(n): indx = min(bisect(c, city), len(c) - 1) city_dist = min(abs(c[indx] - city), abs(c[max(indx - 1, 0)] - city)) max_dist = max(max_dist, city_dist) return max_dist
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 →