The building will be making 90° with the ground/horizontal.
Then we can apply Pythagoras theorem.
(Base)² + (Height)² = (Hypotenuse)²
=> x² + (12 foot)² = (37 foot)²
=> x² = (37 foot)² - (12 foot)²
We can expand LHS using a² - b² = (a + b)(a - b)
=> x² = (37 + 12 foot)(37 - 12 foot)
=> x² = 49 * 25 foot²
=> x² = (7 * 5)² foot²
=> x = 7 * 5 foot
=> x = 35 foot.