算法:二叉树的最大高度

124 阅读1分钟
/**
 * 二叉树的最大深度
 * @param root
 * @return
 */
public static int getBinaryTreeMaxDepth(Node root) {
    if (root == null) {
        return 0;
    }
    return Math.max(getBinaryTreeMaxDepth(root.left), getBinaryTreeMaxDepth(root.right)) + 1;
}
```
```