LeetCode 2221. Find Triangular Sum of an Array in F#
URL
Find Triangular Sum of an Array - LeetCode
Code
let triangleSum (nums: int list) : int =
let rec triangleSum' nums =
match nums with
| [] -> failwith "never reach here"
| h :: [] -> h
| _ ->
let nums = nums |> List.windowed 2 |> List.map (fun v -> (List.sum v) % 10)
triangleSum' nums
triangleSum' nums
Comments
Join the discussionNo comments yet. Be the first to comment.