• + 1 comment

    Add one line k=k%n; before second loop start then you'll pass all the test.