CJCoding With Joseph
15free / daySign inCreate account

Are All Elements Unique?

Write a function bool allUnique(const vector<int>& v) that returns true if no value appears more than once in v and false if any value repeats. An empty vector counts as unique.

The test prints unique when your function returns true and duplicates when it returns false.

Do NOT write a main function.

Expected Output:

unique
duplicates

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
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.