please check! code output is not correct . rectify it.
thanks.
Append last k element in front
hi
there is some error in how u are approaching the problem
u need to move k steps
then, have 2 pointers one at the start and other which is k steps ahead,
so move the pointer that is ahead untill it reaches the end of the linked list
now u just need to manipulate the pointers in a way that the last k elements become the start of the linked list
change the next link of the slow pointer to NULL
nxt_head->next = head;
head = prev_head->next;
prev_head->next = NULL;
I have added comments to the code please see it, incase of any doubts ping me