https://school.programmers.co.kr/learn/courses/30/lessons/42578
function solution(clothes) {
var answer = 1;
const clothKind = clothes.flat().filter((_,i)=> i%2 === 1 ); //1.
// console.log(clothKind)
const arr=[];//2.
for (let i=0;i<clothKind.length;i++) {
let sum =1;
for(let j=0;j<clothKind.length;){
if(i!==j&&clothKind[i]===clothKind[j]){
sum++;
clothKind.splice(j,1)
}else{
j++;
}
}
arr.push(sum);
}
// console.log(arr);
for(let k=0; k<arr.length;k++){
answer*=(arr[k]+1) //3.
}
return answer-1; //4.
}