← Back to STL Containers
Question 465
Count Newly Inserted Values
Count Newly Inserted Values
Write a functionint insertAll(set<int>& s, const vector<int>& v)that inserts every element ofvintosand returns how many of those insertions actually added a new element. For example, ifsstarts as {5} andvis {1, 5, 2, 3, 1}, the function returns 3. Do NOT write a main function.
Expected Output:
3 0
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
STL ContainersSets
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.