Back In the print window choose "Save as PDF" as the destination
NOTE.CS

Remove Duplicates from Array

1 topic · 28 Nov 2026
1

Remove Duplicates from Array

Problem Solving
Solution 1: sort + unique · C++
vector<int> v = {1, 2, 2, 3, 4, 4, 5};
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
// 1 2 3 4 5
Solution 2: set · C++
set<int> s(v.begin(), v.end()); // keeps one of each, sorted