Hi: I need someone to explain to me what this part of the code is doing: ans[(k+i)%n] = nums[i]; I understand it is placing forming a new location for the array values in i with k. What I don't understand is the %n.
class Solution {
public:
    void rotate(vector<int>& nums, int k) {
        int n = nums.size(); // uses size of input array (old array)
        vector<int> ans(n); //new array same size
        
        for(int i = 0 ; i < n ; i++){ //new array = old array // traversing
            ans[(k+i)%n] = nums[i]; // //new array with NEW LOCATION == old array numbers
        }
        
        for(int i = 0 ; i < n ; i++)
            nums[i] = ans[i]; //putting rearrnged new array into old array (ans(i) into nums i)
    }
};
