Our warehouse is square, 200 feet on each side, with solid north and
south walls. The east
and west walls have sliding doors which allow trucks free entry and exit.
Trucks come in a variety of sizes, but the width of each truck is an integer number
of feet.
Unfortunately the roof is supported by posts (of negligible size).
We want to drive big trucks in a straight line into the warehouse through the
west wall and (after unloading and without changing direction) out through the east wall.
Create a class
Warehouse that contains the method feetWide that takes the positions of the
posts as inputs and returns the width of the widest truck (of integral width) that can drive
straight through without touching any posts (or the north or south wall). The positions of the posts are
given by int[] x and int[] y: the i-th element
of x and y gives the distance in feet
east and north respectively from the southwest corner of the building to the i-th post.
|