Find the height of binary tree. Examples: 5 / 3 8 / 1 4 11 The height of above binary tree is 3.
1 public class Solution { 2 public int findHeight(TreeNode root) { 3 // Write your solution here 4 if (root == null) { 5 return 0; 6 } 7 int leftRes = findHeight(root.left); 8 int rightRes = findHeight(root.right) ; 9 return Math.max(leftRes, rightRes) + 1 ; 10 } 11 }