Please tell why my code is not giving the corrdct answer
the code is working fine
void print(node* head)
{
while (head != NULL)
{
cout <<head->data<<" ";
head = head->next;
}
}
int main()
{
node* head = NULL;
int n,d,k;
cin >> n>>k;
// reverse(head);
for (int i = 0; i < n; i++)
{
cin >> d;
insert(head, d);
}
reverse(head);
head=reverse(head,k);
print(head);
}
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.
i got it thank you very much mam
1 Like