how to find the maximum height