One of the testcase is failing in this code , please provide the solution if code is not readable

#include
#include
#include
#include
using namespace std;

class node{
public:
int data ;
nodeleft;
node
right;

node( int d){
    data = d;
    left = NULL;
    right = NULL;
}

};

nodetemp = NULL;
node
buildtree(){
string s;cin>>s;
if(s==“false”){
return NULL;
}
if(s==“true”){
buildtree();
}
if(s!= “true”&&s!= “false”){
noderoot = new node(stoi(s));
root->left = buildtree();
root->right = buildtree();
temp = root;
}
return temp;
}
vectorV;
bool roottoleaf(node
root, int k){
if(root == NULL){
return false;
}
int subsum = k - root->data;
if( subsum == 0){
V.push_back(root->data);
return true;
}
bool a = roottoleaf(root->left,subsum);
bool b = roottoleaf(root->right,subsum);
if(a || b){
V.push_back(root->data);
}

return a ||b;

}
int main() {
node*root = buildtree();
int k;
cin >>k;
roottoleaf(root,k);
reverse(V.begin(),V.end());
for( int i = 0; i < V.size(); i++){
cout << V[i] << " ";
}
return 0;
}

hi @akki56756_bab14f919dbad123

check here https://ideone.com/GFtyXd yours code only but change in function please from next time try sharing on some online ide

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.