Question PRG-CPP-0067
HardWhat is the output of this program?
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> v{3, 1, 4, 1, 5, 9, 2, 6};
nth_element(v.begin(), v.begin() + 3, v.end());
cout << v[3];
return 0;
}
- A.
1
- B.
4
- C.
Sign up free to see the answer and a step-by-step explanation.