• + 2 comments

    C#

    Here you should do exactly what they have explained at the top with the variable decleration. You can get some idea if you refer the given example properly.

    public static List<int> dynamicArray(int n, List<List<int>> queries)
    {
    	var len = queries.Count();
    	var arr = new List<List<int>>();
    	
    	for (int i = 0; i < n; ++i)
    		arr.Add(new List<int>());
    		   
    	var lastAnswer = 0;
    	var answers = new List<int>();
    
    	for (int i = 0; i < len; ++i)
    	{
    		var query = queries[i];
    		var type = query[0];
    		var x = query[1];
    		var y = query[2];
    		
    		var idx = (x^lastAnswer)%n;
    		
    		if (type == 1)
    			arr[idx].Add(y);
    		else
    		{
    			lastAnswer = arr[idx][y % arr[idx].Count()];
    			answers.Add(lastAnswer);
    		}          
    	}
    	
    	return answers;
    }