LeetCode 1822. Sign of the Product of an Array in F#
URL
Sign of the Product of an Array - LeetCode
Code
let arraySign (nums: int list) : int =
let rec arraySign' nums acc =
match nums with
| [] -> acc
| h :: t ->
if h > 0 then arraySign' t acc
elif h = 0 then 0
else arraySign' t (-1 * acc)
arraySign' nums 1