LeetCode 2938. Separate Black and White Balls in F#

URL

Separate Black and White Balls - LeetCode

Code

https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/challenge/202410/separate-black-and-white-balls/main.fsx

let minimumSteps (s: string) : int64 =
    s
    |> Seq.fold (fun (acc, blacks) c -> if c = '0' then acc + blacks, blacks else acc, blacks + 1) (0, 0)
    |> fst
    |> int64