fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5.  
  6. void shiftRight(int arr[], int n) {
  7. std::rotate(arr, arr + n - 1, arr + n);
  8. }
  9.  
  10. int main()
  11. {
  12. std::vector<int> v = {0,1,3,3,4};
  13.  
  14. shiftRight(v.data(), v.size());
  15.  
  16. for (auto e : v) {
  17. std::cout << e;
  18. }
  19. }
  20.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
40133