LeetCode 2579. Count Total Number of Colored Cells in F#
URL
Count Total Number of Colored Cells - LeetCode
Code
let coloredCells (n: int) : int64 =
seq { 1..n }
|> Seq.fold (fun (acc: int64) n -> acc + 2L * (2L * int64 n - 1L)) (-2L * int64 n + 1L)