class Solution { public: int height(Node* temp) { if(temp==NULL) return 0; int lh= height(temp->left); int rh=height(temp->right); return 1+max(lh,rh); } // Function to return the diameter of a Binary Tree. int diameter(Node* root) { if(root==NULL) return 0; int lh=height(root->left); int rh=height(root->right); int ld=diameter(root->left); int rd=diameter(root->right); return max(lh+rh+1,max(ld,rd)); // Your code here } };