Whats Wrong int this code

here is my code link

at line no 81
int p = length(head)-k;
p can be negative if k>length(head).
so u have to take care of that part .
a simple modification like % will work
i think this hint would be engough for u to understand where u are getting wrong results.

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.