Skip to content

Instantly share code, notes, and snippets.

@yaki29
Created May 16, 2018 16:38
Show Gist options
  • Save yaki29/a50be5aeb78e0d8640efa287a4cde25c to your computer and use it in GitHub Desktop.
Save yaki29/a50be5aeb78e0d8640efa287a4cde25c to your computer and use it in GitHub Desktop.
int main() {
int n,l,r;
cin>>n>>l>>r;
node *root;
root=new node;
node *trav=root;
for (int i=0 ; i<n ; i++) {
int x;
cin>>x;
trav->val=x;
if(i!=n-1) trav->next=new node;
else trav->next=NULL;
trav=trav->next;
}
trav=Solve(root,l,r);
while (trav!=NULL) {
cout<<trav->val<<" ";
trav=trav->next;
}
cout<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment