LeetCode Solution: 104. Maximum Depth of Binary Tree

## 104. Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.

The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Note: A leaf is a node with no children.

Example:

Given binary tree [3,9,20,null,null,15,7],

return its depth = 3.

1. 如果当前为空指针就返回0
2. 定义一个左树深度 一个右树深度
3. 如果存在左树或者右树 就继续遍历 （加1表示当前所处为上一层的子树 当前层存在所以加1
4. 因为不知道左树深还是右树深 返回左右树的最大值

Author: Jsthcit