Linked List KAppend

Code is not working for 2 test cases, please help finding the mistake!

hey @ratik_puri , please share code the saved in coding blocks ide

ignore the last comment, this is the code https://ide.codingblocks.com/s/77883

hey ratik, if you read the question carefully, it is clearly mention that k can be greater that N also.consider the below example:

N=7 no.s are 1 2 2 1 8 5 6 K=8, than your answer would be 6 1 2 2 1 8 5…which same as when k=1

soution is to check whether k value is greater than N or not just after you input k, and if it is greater than N, modify k=k%N ( k=8,N=7, k=8%7=1)

make this change and all your testcases will pass

hey ratik, if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear just below where you mark this doubt as resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.