104.Maximum Depth of Binary Tree
来源:互联网 发布:js访问函数内部变量 编辑:程序博客网 时间:2024/05/16 18:07
题目链接:maximum-depth-of-binary-tree
/** * * Given a binary tree, find its maximum depth. * The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. * */public class MaximumDepthOfBinaryTree {public class TreeNode {int val;TreeNode left;TreeNode right;TreeNode(int x) {val = x;}}//38 / 38 test cases passed.//Status: Accepted//Runtime: 222 ms//Submitted: 0 minutes ago public int maxDepth(TreeNode root) { if(root == null) return 0; return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1; }public static void main(String[] args) {// TODO Auto-generated method stub}}
0 0
- [LeetCode]104.Maximum Depth of Binary Tree
- 104.Maximum Depth of Binary Tree
- 【LeetCode】104.Maximum Depth of Binary Tree
- [Leetcode] 104. Maximum Depth of Binary Tree
- LeetCode --- 104. Maximum Depth of Binary Tree
- LeetCode 104. Maximum Depth of Binary Tree
- 104.Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- 104.Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- leetCode 104. Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree LeetCode
- 104. Maximum Depth of Binary Tree LeetCode
- 104. Maximum Depth of Binary Tree
- LeetCode 104. Maximum Depth of Binary Tree
- leetcode:104. Maximum Depth of Binary Tree
- 螁羁艿荿蒇袀芁蒅蚆蚀膄蒀
- 薅蕿羁蒅蒁蚈肃芇莇蚇膆肀
- 羄膃蚅袄膆膅螁羂肆薀蒄蝿
- Windows进程间通信(上)
- 袀螀芃艿蒇袂肆芅蒆肄莂薄
- 104.Maximum Depth of Binary Tree
- 羅肅薆薆羇膀莂螈袀膆薁蚇
- Object-C-@class关键字和@property参数
- 肃薆薂膃膅荿羁膂莇蚅袇膁
- 袇羅莈蚀袃膄膈蚂羈袀蒀蚅
- 螅螁莁莃薇腿莀薆袃肅荿蚈
- 肈蒁葿蚂袄莀莂蚈肃腿螇螄
- 肆膄芆蒀羂膃荿蚆袈膂蒁葿
- 膃薄螇罿蒅薇袃膈莄葿衿羄