what was wrong in my code i getting two test case wrong.
Linked List-K Append11
Hi Piyush
You are not considering the case when k is larger than n . (It is mentioned in the problem statement that it may be).
Consider this testcase
Input :
7
1 2 2 1 8 5 6
10
Expected Output :
8 5 6 1 2 2 1
Your Output :
-1
Try taking modulo of k with n i.e. k = k % n
(Do not forget about the corner case when k is a multiple of n though)
Hit like if you get it.