• + 72 comments
    int count = 0;
        for(int i=0; i<n; i++){
            if(c[i]!=0){
                 for(int j=i+1; j<n; j++){
                    if(c[i]==c[j]){
                        count++;
                        c[j]=0;
                        break;
                        }
                    }           
            }
        }
        printf("%d", count);
    

    Solution in C.. O(N^2).. Can it be optimized in C?? Please help..