Test cases failing

I am dividing the linked list at " toappend ". and looping throught toappend and connecting it with head . and changing head ,still 3 test cases are failing. Can you please tell what is wrong with my code

@nishchay-verma k can be greater than n also

I am confused what will k > n give as answer.
5
1 2 3 4 5
10
where 10 is k.
What will the output in this case because there arent even 10 digits in the linked list.

@nishchay-verma the task is to take the last element, and append it to the beginning of the list. You can do that infinite amount of times since the size of list is not changing. Do this operation k times. Size of list in relation to k is not relevant. But you can optimize it by using mod operation since there will be repetition if k >= n

Thanks a lot now all test cases are passing.

@nishchay-verma please mark the doubt as resolved

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.