2
def maxDistToClosest(self, seats: List[int]) -> int:3
# strategy is greedy solution:4
# calculate local maximum for each interval: (b-a)//25
# then take max of local maximums7
# I find this solution clear, but uses 5 passes9
# get all the occupied seat nums10
seat_nums = [ix for ix, val in enumerate(seats) if val == 1]13
left_max, right_max = min(seat_nums), len(seats) - max(seat_nums) - 115
# calculate max distance for each gap16
dists = [(y - x) // 2 for x, y in zip(seat_nums, seat_nums[1:])]18
# take max of sitting on either end + each gap19
return max([left_max, right_max, *dists])