LeetCode 1921. Eliminate Maximum Number of Monsters in F#
URL
Eliminate Maximum Number of Monsters - LeetCode
Code
https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/problems/1921/main.fsx
let eliminateMaximum (dist: int list) (speed: int list) : int =
List.zip dist speed
|> List.map (fun (d, s) -> double d / double s)
|> List.sort
|> List.indexed
|> List.fold (fun acc (i, time) -> if time <= i then acc else acc + 1) 0