Sales by Match

  • + 0 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;