Error:
Since it is BST, once again, I misunderstand the question. It need to use the property of BST:
if(root->val > p->val && root->val > q->val)
return common(root->left, p, q)
else if(root->val < p->val && root->val < q->val)
return common(root->right, p, q)
else
return root
The idea behind it similar than non-BST