• + 0 comments

    My C++ solution

    vector circularArrayRotation(vector & arr, int k, vector queries) { vector res; // k % arr.size() enusre that we are not unnecessarily rotating back to original std::rotate(arr.rbegin(), arr.rbegin() + (k % arr.size()), arr.rend());

    for (auto a : queries)
        res.push_back(arr[a]);
    
    return res;
    

    }