unordered set Question 6

Last Updated :
Discuss
Comments

What will be the output of the following C++ code?

C++
#include <bits/stdc++.h>
using namespace std;

int main()
{
    unordered_set<int> s1 = {1, 2}, s2 = {2, 3};
    s1.merge(s2);
    for (auto x : s1)
        cout << x << " ";
    cout << endl;
    for (auto x : s2)
        cout << x << " ";
    return 0;
}


3 2 1
2 3

3 2 1
2

3 2 1

error

Share your thoughts in the comments