@muzhou @Patrick1993 my solution is very similar to Patrick1993's solution except that I save on one addition by first comparing the values return by recursive call and then only adding to the one that is greatest.

public int maxDepth(TreeNode root) { if (root == null) return 0; int maxL = maxDepth(root.left); int maxR = maxDepth(root.right); if ( maxL > maxR) return maxL + 1; else return maxR + 1; } }Maximum Depth of Binary Tree