lc-go/solutions/17/q1732/solution.go

14 lines
279 B
Go

// Package q1732 implements a solution for https://leetcode.com/problems/find-the-highest-altitude/
package q1732
func largestAltitude(gain []int) int {
alt := 0
max_ := 0
for _, g := range gain {
alt += g
max_ = max(alt, max_)
}
return max_
}
var _ = largestAltitude