Still ek test case pass nehi ho raha hai

in the reverse k function k = k%n should be performed when k >= n, rather then when k > n moreover you should add an additional if to handle the case of k == 0 after k = k%n
Corrected Code

but in Constraints says that k>=1

if k = 2n, then you would perform k = k%n, which would make k = 0.

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.