LeetCode 2938. Separate Black and White Balls in F#
URL
Separate Black and White Balls - LeetCode
Code
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