Tree
111. Minimum Depth of Binary Tree
This is not just the mirror of maximum depth, and the reason is the definition of "leaf": the path must end at a node with no children. If you naively return 1 + min(left, right), a node with only…
Loading…
This is not just the mirror of maximum depth, and the reason is the definition of "leaf": the path must end at a node with no children. If you naively return 1 + min(left, right), a node with only…
Loading…