I am trying to use rotate but faild anyone knows why?


  • 0
    class Solution 
    {
    public:
        void rotate(int nums[], int n, int k) 
        {
            vector<int> myvector;
            for(int i=0;i<n;i++)
             myvector.push_back(nums[i]);
            rotate(myvector.begin(),myvector.begin()+k+1,myvector.end());
            
        }
    };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.