The most general formula useful here would be
s = s0 + v0*t + (1/2)at^2, where s0 is the original height, v0 is the original velocity, a is the acceleration, and t is the time.
Here, s becomes 0 (baseball is on the ground)
v0 is 0, since the initial speed of the ball was 0.
a is the acc'n due to gravity, and is -9.8 m per (sec)^2 in the metric sys.
t is known and is 5.23 sec
All that is left to find is s0, the original height (which is the building height).
0 = s0 + (0)(5.23 sec) + (1/2) (-9.8 m per sec^2)(5.23 sec)^2
-s0 = 0 - (4.9 m per sec^2) ( 27.35 sec^2)
So s0 = 134 meters (approx)
The building height was approx. 134 meters.