LeetCode 222. Count Complete Tree Nodes in F#

URL

leetcode.com/problems/count-complete-tree-n..

Code

github.com/syohex/dotnet-study/blob/master/..

type Tree =
    | Leaf
    | Node of int * Tree * Tree

let rec countNodes (root: Tree) : int =
    match root with
    | Leaf -> 0
    | Node (_, left, right) -> 1 + countNodes left + countNodes right