← Quiz: STL Algorithms: all 10 questions
Quiz: STL Algorithms · Question 2 of 10
What must you do before calling unique to remove all duplicates?
What must you do before calling unique to remove all duplicates?
- A.Reverse the vector
- B.Sort it
- C.Clear it
- D.Nothing
Answer & explanation
Correct answer: Sort it
unique removes only ADJACENT duplicates, so sort first.
Can you get the rest right without peeking?
Take the timed Quiz: STL Algorithms quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →