Diagram time. Top of fence is A. Bottom of fence is B. Ladder touches ground at C, and touches wall at D. Horizontal line from top of fence to wall, touches wall at E. Call length BC "g" for "ground" and length DE "w" for "wall". Call the length of the ladder "h".
Notice you have two similar right triangles, ABC and DEA. Because of this, their side lengths form a proportion: 1.5/g = w/1. Equivalently, g = 1.5/w.
The height of the ladder can be found by adding the hypotenuses of these two triangles:
`h = sqrt(g^2+1.5^2)+sqrt(1^2+w^2)`
Substitute g = 1.5/w, simplify a bit to get
Now, if we graph this, we want to find a local minimum. So we could look at dh/dw and find where it goes from negative to positive, but this is a mess. I hope calculators are allowed, so you can graph it and find the minimum at h = 3.5117m