Skip to content

Instantly share code, notes, and snippets.

@hmenn
Created March 2, 2019 19:52
Show Gist options
  • Save hmenn/22e1efc93beac003e63a3f10887aae87 to your computer and use it in GitHub Desktop.
Save hmenn/22e1efc93beac003e63a3f10887aae87 to your computer and use it in GitHub Desktop.
hackerrank - intertiew kit - arrays
// Complete the rotLeft function below.
vector<int> rotLeft(vector<int> a, int d) {
std::vector<int> v;
for(int i=0; i<a.size();++i){
v.push_back(a[(i+d)%a.size()]);
}
return v;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment