this is the ide link
Can you tell me the testcases for which the code is giving wrong answers
@shivanshmittal25 In line 66 you are doing k=k%n. Your code is failing for the cases where k becomes 0. For rest of the case your code is working fine. Handle the case when k==0 separately and then check.