vector<int> v;
int n=nums.size();
int f=k%(n);
int a=n-f;
for(int i=0;i<n;++i)
{
if((a+i)<=(n-1))
v.push_back(nums[a+i]);
else
v.push_back(nums[a+i-nums.size()]);
}
nums=v;}
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter