104. 二叉树的最大深度
没什么好办法,深搜或者宽搜暴力遍历吧
class Solution { public int maxDepth(TreeNode root) { if (root == null) { return 0; } return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1; } }