Kreverse in linked list

hi @shrutikatyal do k = k % n for cases where k > n https://ide.codingblocks.com/s/329537 i get such kind of reply on my code when my code was passing two test cases but still its not working pls tell my mistake . if possible make suitable change but dont change the entire code…

Hey @shrutikatyal
This is what you have to do replace

if(K>N)
{
K=K%N;
return head;
}

By this

if(K>=N) //equality aayegi
{
K=K%N;
//why will we return from here
}
if(K==0)return head; //we return if K is 0

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.