gain
function largestAltitude(gain: number[]): number { let highScore = 0 let curScore = 0 for(const score of gain) { curScore += score highScore = Math.max(highScore, curScore) } return highScore };