# Leetcode 111 - Minimum depth of binary tree

`Note`

- Don’t really need
`level order`

traversal. - Be careful of the
`termination condition`

: return`1`

when both`root.left`

and`root.right`

are`null`

. (1 because we need the number of nodes but not just depth) - Three situations to consider
- Have both left and right child.
- Only left node.
- Only right node.

Given a binary tree, find its minimum depth.

The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

Note: A leaf is a node with no children.

**Example**

1 | Input: root = [3,9,20,null,null,15,7] |

1 | /** |