LeetCode 2579. Count Total Number of Colored Cells in F#

URL

Count Total Number of Colored Cells - LeetCode

Code

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

let coloredCells (n: int) : int64 =
    seq { 1..n }
    |> Seq.fold (fun (acc: int64) n -> acc + 2L * (2L * int64 n - 1L)) (-2L * int64 n + 1L)