• + 0 comments

    C++ Solution

    vector circularArrayRotation(vector a, int k, vector queries) { vector res; for(auto& q : queries) { int index = (q + a.size() - k%a.size()); if(index >= a.size()) index = index % a.size(); res.push_back(a[index]); } return res; }