My issue
why my code cannot complete all test cases.
My code
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int a, b, c, k, d, i, q;
unordered_map<int, int> l;
cin >> a;
while (a--) {
cin >> b;
q = b;
int arr[b];
k = INT_MIN;
d = INT_MAX;
i = 0;
while (b--) {
cin >> arr[i];
l[arr[i]]++;
i++;
}
for (int j = 0; j < q; j++) {
if (arr[j] > k) {
k = arr[j];
}
}
for (int j = 0; j < q; j++) {
if (arr[j] < d) {
d = arr[j];
}
}
for (int p = d; p <= k; p++) {
if (l[p] != 2) {
cout << p <<" ";
}
}
l.clear();
cout<<endl;
}
return 0;
}
Problem Link: Chef and Dolls Practice Coding Problem - CodeChef