Question: SAP Labs, Recent Online Assessment Questions | Remove all the Duplicate Numbers | 2023
1
Entering edit mode

ADD COMMENTlink 14 months ago Delta 2.9k
0
Entering edit mode

```

void solve() {
    // Add your code here
    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    map<int, int> m;
    for (int i = 0; i < n; i++) {
        if (m.find(v[i]) == m.end()) {
            cout << v[i] << " ";
        }
        m[v[i]]++;
    }
}
 

```

ADD COMMENTlink 14 months ago adarsh.anand.20031 • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts