Let x and y be the sides of the fence, with the side y parallel to the warehouse if you like.

Then xy=area of yard

2x+y=1000

y=1000-2x

Differentiate this and equate to zero to find x corresponding to max area.

Use this x to find y

If the fence has one side equal to the warehouse side,

then it's 3 sides sum to 1000, while one side is 250.

Hence the other 2 sides sum to 750, so they are 375.

That is the only rectangular shape possible if one side is 250.

The above solution, using differentiation gives an area of 125,000 square units,

which is a greater area than if the fence encloses a square by touching the sides of the warehouse,

however the fence does not form a closed shape!