Let x ft be the length of the ladder, then the distance from the ground to the top of it will be x-1 ft.
If the distance from the bottom of the ladder to the building is 3 ft, then we can apply Pythagoras:
x² = (x-1)² + 3² . Expand:
x² = x² - 2x + 1 + 9
x² = x² - 2x + 10
x² - x² = - 2x + 10
0 = - 2x + 10
2x = 10 and x = 5 ft