* Definition for a binary tree node.
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
int depth(TreeNode* root)
return 1+max(depth(root->left), depth(root->right));
int diameterOfBinaryTree(TreeNode* root) {
if(!root || (!root->left && !root->right)) return 0;
//cout<<depth(root->left)<< "+" <<depth(root->right)<<endl;
int res=depth(root->left) +depth(root->right);
res=max(res,diameterOfBinaryTree(root->right));
res=max(res,diameterOfBinaryTree(root->left));