Maximize Distance to Closest Person

You are given an array seats of length n where seats[i] is 0 if the i-th seat is empty and 1 if it is occupied by a person. There is always at least one occupied seat and at least one empty seat.

Choose one empty seat seats[i] to sit in such that the maximum number of seats you are away from the closest occupied person is as large as possible.

Return that maximum distance. The distance between two seats is the absolute difference of their indices. For an empty seat next to an occupied person on one side and a wall on the other, the distance to the closest person is measured only to the occupied person; a wall does not count as a person.

Examples
Input: [1,0,0,0,1,0,1]
Output: 2
Hints

Maximize Distance to Closest Person

You are given an array `seats` of length `n` where `seats[i]` is `0` if the `i`-th seat is empty and `1` if it is occupied by a person. There is always at least one occupied seat and at least one empty seat.