Count Unique Values
easyQuestion 460Write a function int countUnique(const vector<int>& v) that returns how many distinct values appear in v. Insert every element of the vector into a set<int> and return the set's size, cast to int.
Do NOT write a main function.
Expected output
3 1
= newline. The output ends with a newline, so 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.