夏天到了 不想学习 写个简单的代码清醒一下 然后突然发现然并卵 这比装的自己都看不下去了 o(︶︿︶)o 唉 不说了 还是乖乖去改论文吧。。。
Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.
代码
public class Solution {
public int maxDepth(TreeNode root) {
return (root == null)?0:Math.max(1+maxDepth(root.left),1+maxDepth(root.right));
}
}