You are viewing a single comment's thread. Return to all comments →
this should work for C as the problem says: 1 <= ar[i] <=100
int i, res = 0; int map[101] = {0}; for(i = 0; i < n; i++) { map[ar[i]]++; if (map[ar[i]] == 2) { res++; map[ar[i]] = 0; } } return res;
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →
this should work for C as the problem says: 1 <= ar[i] <=100