(TreeNode root, int maxi[])
| 9 | |
| 10 | } |
| 11 | public int findDiameter(TreeNode root, int maxi[]) |
| 12 | { |
| 13 | if(root == null) return 0; |
| 14 | int left = findDiameter(root.left,maxi); |
| 15 | int right = findDiameter(root.right,maxi); |
| 16 | maxi[0]=Math.max(maxi[0],left+right); |
| 17 | return 1+Math.max(left,right); |
| 18 | } |
| 19 | } |
no outgoing calls
no test coverage detected