LeetCode 1637. Widest Vertical Area Between Two Points Containing No Points in F#
URL
Code
https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/problems/1637/main.fsx
open System
let maxWidthOfVerticalArea (points: (int * int) list) : int =
points
|> List.sort
|> List.windowed 2
|> List.fold
(fun acc ps ->
match ps with
| (x1, _) :: (x2, _) :: [] -> Math.Max(acc, x2 - x1)
| _ -> failwith "never reach here")
0