Given a linked list of length N and an integer K , append the last K elements of a linked list to the front. Note that K can be greater than N


I am not able to figure out, it is not passing all test case.
please help me also where I did wrong please comment that line as well as correct it

@mkjha
There is a small change in the rotate function. This is the updated code. Please refer to it once and revert in case you face any difficulty.

why did u use k=k%a in the rotate function

it saying Time limit exceeded

@mkjha
There was a problem in the test cases. Thus this was a heuristic.
It shouldnt. Did you run the above code. I ran the above one and it did pass all the test cases.
Revert in case you face any diffiiculty.