• + 0 comments

    This can be easily done with a one liner O(1) time and O(1) space

    cout << a[(n+(m-k)%n)%n] << endl;