MaximumDepthBinaryTreeSolution { static int maxDepthFirstDepth(TreeNode root) { return root == null ? 0 : Math.max(maxDepthFirstDepth(root.left), maxDepthFirstDepth(root.right)) + 1; }    }
@Test public void maxDepthFirstDepth() { assertEquals(0, MaximumDepthBinaryTreeSolution.maxDepthFirstDepth(null)); TreeNode root0 = new TreeNode(0); assertEquals(1, MaximumDepthBinaryTreeSolution.maxDepthFirstDepth(root0)); TreeNode left1 = new TreeNode(1); left1.left = new TreeNode(2); root0.left = left1; assertEquals(3, MaximumDepthBinaryTreeSolution.maxDepthFirstDepth(root0)); }