I am using append function to append the k elements to front but it is not passing all the testcases
Naman, I have made corrections in your code, refer to it
Basically, you havent ncluded the case when k is greater than n, thats why I have used k=k%n, and then if k==0, then simply print your linked list… or else use append function and then print the linked list.