输入banner图图片脚本导航/分类

leetcode513 FindBottomLeftTreeValue Java

int res = 0,h = 0; 2 public int findBottomLeftValue(TreeNode root) { 3 findBottomLeftValue(root, 1); 4 return res; 5 } 6 public void findBottomLeftValue(TreeNode root, int depth) { 7 if(h < depth) {res=root.val; h=depth;} 8 if(root.left != null) findBottomLeftValue(root.left, depth+1); 9 if(root.right !=null) findBottomLeftValue(root.right, depth+1); 10 }

 

leetcode513 FindBottomLeftTreeValue Java

标签:value   java   node   bsp   treenode   class   root   bottom   void