LeetCode 226. Invert Binary Tree in F#

URL

https://leetcode.com/problems/invert-binary-tree/description/

Code

https://github.com/syohex/dotnet-study/blob/master/fsharp/leetcode/problems/0226/main.fsx

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

let rec invertTree (root: Tree) : Tree =
    match root with
    | Leaf -> Leaf
    | Node (v, left, right) -> Node(v, invertTree right, invertTree left)