Skip to content

Instantly share code, notes, and snippets.

@cixuuz
Last active August 5, 2017 01:26
Show Gist options
  • Save cixuuz/6fe96c9b1c01953b30b28751e4e4cde0 to your computer and use it in GitHub Desktop.
Save cixuuz/6fe96c9b1c01953b30b28751e4e4cde0 to your computer and use it in GitHub Desktop.
[104 Maximum Depth of Binary Tree] #leetcode
public class Solution {
public int maxDepth(TreeNode root) {
if (root == null) {
return 0;
}
return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment