I am only able to pass half of the test cases and i tried different test cases but could not able to figure out where i am gng wrong
Linked List k Append Doubt
code and logic is correct
only one mistake is
if(k>=n) return head
this statement is wrong
correct statement should be
if(k==n) return head;
if(k>n) k=k%n;
this is because suppose k=10 and n=7;
so first when we append 7 element from last to first linked list became same as previous one
now when we append next 3 element only these element effect the linked list
so i make k=k%n;
Modified Code
if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like
: and donβt forgot to mark doubt as resolved 
1 Like