Find the Highest Altitude LeetCode solution in JavaScript

1
var largestAltitude = function (gain) {
2
let points = [0];
3
let highest = 0;
4

5
for (let i = 0; i < gain.length; i++) {
6
let point = points[i] + gain[i];
7
points.push(point);
8
if (point > highest) highest = point;
9
}
10

11
return highest;
12
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0