You are viewing a single comment's thread. Return to all comments →
C++
vector<int> rotLeft(vector<int> a, int d) { vector<int> arr; int siz = a.size(), idx; for(int i = 0; i < siz; i++){ idx = (i + d) % siz; arr.insert(arr.end(), a[idx]); } return arr; }
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
C++