LeetCode 452. Minimum Number of Arrows to Burst Balloons in F#
URL
Minimum Number of Arrows to Burst Balloons - LeetCode
Code
let findMinArrowShots (points: (int * int) list) : int =
let rec findMinArrowsShots' points endPoint ret =
match points with
| [] -> ret
| (s, e) :: t ->
if endPoint < s then
findMinArrowsShots' t e (ret + 1)
else
findMinArrowsShots' t endPoint ret
let points' = List.sortBy snd points
findMinArrowsShots' points' (List.head points' |> snd) 1