← AlgoMindset 75

Find the Highest Altitude

Easy🎙 Interview me on this

🧠 Before you code — what pattern fits?

A biker starts a trip at altitude 0. Given an array gain where gain[i] is the net gain in altitude between points i and i+1, return the highest altitude reached.

[-5,1,5,0,-7] → 1

[-4,-3,-2,-1,4,3,2] → 0

🎬 Video explanation · Programmers Zone

Your solution runs against 2 unit tests, including edge and large-value cases.

Loading...

Test console · 2 unit tests

Submit your code to run it against all 2 unit tests. Results appear here.

JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.