URL
https://leetcode.com/problems/binary-tree-inorder-traversal/description/?envType=daily-question&envId=2023-12-09
Code
https://github.com/syohex/dotnet-study/blob/master/fsharp/leetcode/challenge/202312/binary_tree_inorder_traversal/main.fsx
type Tree =
| Leaf
| Node of int * Tree * Tree
let inorderTraversal (root: Tree) : int list =
let rec inorderTraversal' node acc =
match node with
| Leaf -> acc
| Node(v, left, right) ->
let acc' = inorderTraversal' left acc
inorderTraversal' right (v :: acc')
inorderTraversal' root [] |> List.rev