We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- STL
- Vector-Erase
- Discussions
Vector-Erase
Vector-Erase
Sort by
recency
|
409 Discussions
|
Please Login in order to post a comment
all test case clear
Earasing the vectors using the C++ language
Code solution :
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ vectorv; int n,x; cin>>n; for(int i = 0; i>x; v.push_back(x); } int y; cin>>y; v.erase(v.begin()+y-1); int z,a; cin>>z>>a; v.erase(v.begin()+(z-1), v.begin()+(a-1));
}
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ vector v; int n, loc, start, end; cin >> n; for (int i=0; i < n ; i++) { int element; cin >> element; v.push_back(element); }
}
this is my solution
include
using namespace std;
define ll long long
define vec vector
define all(x) x.begin(),x.end()
define yes cout<<"YES"< define no cout<<"NO"<int main() { int N; cin>>N; vectorarr(N); for(int i=0;i>arr[i]; } int x; cin>>x; arr.erase(arr.begin()+x-1); int a,b; cin>>a>>b; arr.erase(arr.begin()+a-1,arr.begin()+b-1); cout<
}
the inputs a and b pissed me off.