I get failed in the last test caseā¦please guide me where I did mistake
Linked list k appned test case failes
since after n appendings list returns to its original state, after taking input k, replace it with k%n.
Corrected Code
Sir,I dont understand why we replace k by k%n
say k = 15, and n = 10. then after you do 10 appendings the list will return to its original state. so you would end up performing effectively only 15-10 = 5 appending which is equal to k%n.
1 Like
Thanks Sir for clearing my doubt