• + 1 comment

    Do this. Had same issue and it fixed it.
    k=k%n; Looking at the test case found that k is pretty large.