Print all nodes that don't have sibling

Question Link

//Can anyone help me out in the question
// my solution

void solve(Node *node,vector&vec){

if(node == NULL){//base
    return;
}

if(node->left==NULL && node->right != NULL){
    vec.push_back(node->right->data);
}

if(node->right==NULL && node->left != NULL){
    vec.push_back(node->left->data);
}

noSibling(node->left);

noSibling(node->right);

}

vectornoSibling(Node* node)
{
vectorvec;
solve(node,vec);
return vec;
}

// There is something that I want to change in the code