My code is not working for k>n

my code is working fine for k<n but when it goes more than n it stops working i even looked at editorial but that only works when k=n+1

this is my code plz check.

hi… ur code is failing for k = 1 also… try to rectify it… and for k > n just add one statement that k = k%n … it will work…

if u still have any doubt u can refer my code https://ide.codingblocks.com/s/609218

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.