author: Blankj blog : http://blankj.com time : 2017/10/09 desc :
| 12 | * </pre> |
| 13 | */ |
| 14 | public class Solution { |
| 15 | public int maxDepth(TreeNode root) { |
| 16 | if (root == null) return 0; |
| 17 | return 1 + Math.max(maxDepth(root.left), maxDepth(root.right)); |
| 18 | } |
| 19 | |
| 20 | public static void main(String[] args) { |
| 21 | Solution solution = new Solution(); |
| 22 | System.out.println(solution.maxDepth(TreeNode.createTestData("[]"))); |
| 23 | System.out.println(solution.maxDepth(TreeNode.createTestData("[1,2,2,3,4,4,3]"))); |
| 24 | System.out.println(solution.maxDepth(TreeNode.createTestData("[9,-42,-42,null,76,76,null,null,13,null,13]"))); |
| 25 | } |
| 26 | } |
nothing calls this directly
no outgoing calls
no test coverage detected