Java recursion
\nint maxDepth = 0;\nTreeNode result = null;\npublic TreeNode subtreeWithAllDeepest(TreeNode root) {\n\tdepth(root, 0);\n\treturn result;\n}\npublic int depth(T
```\nint maxDepth = 0;\nTreeNode result = null;\npublic TreeNode subtreeWithAllDeepest(TreeNode root) {\n\tdepth(root, 0);\n\treturn result;\n}\npublic int depth(TreeNode root, int depth) {\n\tif(root == null) return depth-1;\n\tif(maxDepth<depth) maxDepth = depth;\n\tint left = depth(root.left, depth +1);\n\tint right = depth(root.right, depth +1);\n\tif(left == maxDepth && right == maxDepth) result = root;\n\treturn Math.max(left,right);\n}\n```
[]