Company: wex_2ndaug
Difficulty: medium
Maximize Distance to Closest Person Problem Description A waiting room has a single straight bench of n seats, numbered 0 to n - 1 from left to right. Some seats are already taken and the rest are free. The bench is described by an array seats : seats[i] = 1 if seat i is taken and seats[i] = 0 if it is free. Riya walks in and must sit on one of the free seats. She does not want company, so she chooses the free seat whose nearest occupied seat is as far away as possible. The distance between seats i and j is |i - j| . Print the largest possible distance between Riya and the occupied seat nearest to her. It is guaranteed that the bench has at least one free seat and at least one occupied seat. Complete the function maxDistToClosest(seats) , which returns this distance. Input Format The first line contains a single integer n , the number of seats. The second line contains n space-separated integers seats[0] seats[1] ... seats[n-1] , each 0 or 1 . Output Format Print a single integer: the