LeetCode 1732. Find the Highest Altitude in F#
URL
Find the Highest Altitude - LeetCode
Code
https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/problems/1732/main.fsx
let largestAltitude (gain: int list) : int =
gain
|> List.fold
(fun (alt, ret) n ->
let alt' = alt + n
alt', System.Math.Max(ret, alt'))
(0, 0)
|> snd