• + 0 comments

    Java solution

    public static int getHeight(Node root){
      //Write your code here
      int height = -1;
    
      if(root != null){
    
    
      int leftHeight = getHeight(root.left);
      int rightHeight = getHeight(root.right);
    
      height = Math.max(leftHeight, rightHeight) + 1;
      }
    
      return height;
    }