/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public int treeDepth(TreeNode root) {
if (root == null) {
return 0;
}
return 1 + Math.max(treeDepth(root.left), treeDepth(root.right));
}
}