Let initial velocity be u, final velocity be v, acceleration due to gravity be g and distance covered be h.
Given, final velocity, v=0
Using Newton’s third equation of motion,
v2=u2−2gh ('g' is negative because the body is thrown up, i.e it's motion is against gravity)
⇒2gh=u2
⇒h=u22g