Hi, I need help.

The organisers of a sheepdog competition have 100 metres of fencing available to fence an enclosure for some sheep. They wish to make the area rectangular and as large as possible. What dimensions should the enclosure have to maximise the area if

a) the 100m of fencing is to be used for all four sides,

b) an existing wall forms one side and the fencing is used for the other three.

I've attempted A) by drawing the diagram and using 4x=100 and I got 25m as my answer, I want to know if there is another way.

As for b) I have tried everything and still can't figure it out, I would appreciate help.

Thank you!