• + 0 comments
    C LANGUAGE:::
    
    int gemstones(int arr_count, char arr) {
        int alphbetical_array[26]={0};
        for(int i=0;i<arr_count;i++){
            int temp_alphaArrray[26]={0};// temporary array used to find duplicate minerals
            for(int j=0;arr[i][j]!='\0';j++){
                // if temp_alphaArray has already a mineral, it doesn't execute
                if(!(temp_alphaArrray[arr[i][j]-'a'])){ // used for a single mineral once
                    temp_alphaArrray[arr[i][j]-'a']++;
                    alphbetical_array[arr[i][j]-'a']++;
                }
            }
        }
        
        int count=0;
        for(int i=0;i<26;i++){
            if(alphbetical_array[i]==arr_count){
                count++;
            }
        }
        
        return count;
    }**
    

    `