LeetCode 1822. Sign of the Product of an Array in F#

URL

Sign of the Product of an Array - LeetCode

Code

https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/challenge/202305/sign_of_the_product_of_an_array/main.fsx

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