Kreverse in linked list

If you dry run your code once tail1 is NULL initially and you are trying to access tail1->next which is resulting in a runtime error. Try to modify your code once within the given logic so that the code does not access tail->next when tail itself is NULL . (use if condition when tail1 is NULL) .i cant understand what you are saying if possible made change in the line which is giving run time error ,multiple time i have send my code but still unable to resolve my doubt pls resolve as soon as possible

@shrutikatyal hey do k=k%length of linked list ,then apply same logic as you have applied you will get it.

where i should apply k=k%length means in which line

@shrutikatyal hey you have to that in starting after taking the iput of k as this will handle the case when k>length of ll , please take a example and dry run it using that logic. Happy coding.

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.