The turnpike has mile markers at each mile along its length, with 0 at the western end
and pikeLength at the eastern end (so it is exactly pikeLength miles long).
We locate our service
plazas at various mile markers. Each plaza
can service traffic going in either direction, so we never place multiple
plazas at the same mile marker. We also never place a plaza at either end of
the turnpike.
The locations of all the existing plazas are given in a int[] plazas. We are
interested in locating n new plazas along the turnpike in such a way as to
minimize the longest segment of turnpike that has no plaza. Given pikeLength, n,
and plazas, determine the best locations for the n new plazas and return the length of the
longest unserviced segment after the new plazas have been added.
|