My code is not passing all test cases

code id :

k can be greater than n and your code is printing the same linked list without any changes in it.
For example, lets say the linked list is -
1 2 3 4 and k = 5.
Your code’s output is - 1 2 3 4
And the correct output is - 4 1 2 3

I have updated my code and still it is passing only 4 test cases

code id: https://ide.codingblocks.com/s/192183

You have generalized for k>n which is wrong.
In the example which I gave you, if k = 6
Your code’s Output is - 4 1 2 3
And Correct Output is - 3 4 1 2
Try again and tell me if you are able to figure out the mistake. Else I will give you the correct approach to solve this.

@vanshika1205 Please mark your doubt as resolved if you are satisfied