We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You're over-complicating things with two loops and C arrays in C++.
int n, d;
cin >> n >> d;
vector<int> v((istream_iterator<int>(cin)), istream_iterator<int>());
for (int i = 0; i < n; ++i) cout << v[(i + d) % n] << " ";
Left Rotation
You are viewing a single comment's thread. Return to all comments →
You're over-complicating things with two loops and C arrays in C++.