currentAltitude
to 0.highestPoint
to currentAltitude
.altitudeGain
in the gain
array.
a. Add altitudeGain
to currentAltitude
.
b. If currentAltitude
is greater than highestPoint
, update highestPoint
with currentAltitude
.highestPoint
as the highest altitude reached.