You are viewing a single comment's thread. Return to all comments →
If anyone has suggestions on how to improve this, please let me know! I'm doing my best to learn how to become an efficient programmer.
vector<int> rotLeft(vector<int> a, int d) { vector<int> a2(a.size()); for (int i = 0; i < a2.size(); i++, d++) { if (d == a2.size()) { d = 0; } a2[i] = a[d]; } return a2; }
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
If anyone has suggestions on how to improve this, please let me know! I'm doing my best to learn how to become an efficient programmer.