According to the law of conservation, energy can neither be created nor be destroyed but can transform from one form to another.
Therefore, K.E. Lost by the ball = P.E. gained by the ball
So, as velocity of ball becomes zero then K.E. would be zero and the P.E. would be maximum