Answers for "c++ reverse part of vector"

C++
21

c++ reverse vector

#include <bits/stdc++.h> // Vector
#include <algorithm>  // Reverse 
using namespace std;

int main()
{
    vector<int> nums{4,1,2,1,2};

    reverse(nums.begin(), nums.end());
    return 0;
}
Posted by: Guest on April-26-2020
1

c++ reverse part of vector

//Reverse vector partially (from index x to index y)
reverse(v.begin()+x, v.begin()+y+1);
Posted by: Guest on October-05-2020
0

reverse a vector c++

// Given the vector
vector<int> a = { 1, 45, 54, 71, 76, 12 };

// Reverse the vector
reverse(a.begin(), a.end());
Posted by: Guest on May-23-2021
0

reverse in vector c++

reverse(start_index, last_index);
Posted by: Guest on May-03-2020

Browse Popular Code Answers by Language