• + 0 comments

    JS:

    function gemstones(arr) {
        // Write your code here
       let alp=arr[0].split('');
       let newarr=new Set();
       for(let x=0;x<alp.length;x++){
          let found=true;
          for(let i=1;i<arr.length;i++){
           if(arr[i].indexOf(alp[x])==-1){
               found=false;
           }
         } 
         if(found){
             newarr.add(alp[x]);
         }
       }
       console.log(arr,newarr)
       return newarr.size;
      
    

    }