What is wrong with my solution .help me please


#1
    • List item

bool search(TreeNode* root,int a)
{
if(root == NULL)
{
return false;
}
if(root->val == a)
{
return true;
}
return (search(root->left,a) || search(root->right,a));
}
int Solution::lca(TreeNode* a, int b, int c)
{
if(!(search(a,b)&&search(a,c)))
{
return -1;
}
if((b < (a->val)) && (c < (a->val)))
return lca(a->left,b,c);
if((b > (a->val)) && (c > (a->val)))
return lca(a->right,b,c);
return a->val;
}`