LeetCode 2379. Minimum Recolors to Get K Consecutive Black Blocks in F#
URL
Code
let minimumRecolors (blocks: string) (k: int) : int =
let countWhite = Array.filter ((=) 'W') >> Array.length
blocks
|> Seq.windowed k
|> Seq.fold (fun acc v -> min acc (countWhite v)) blocks.Length