Link
Notice
HIT해
[JS 프로그래머스] 의상.해시 본문
728x90
https://school.programmers.co.kr/learn/courses/30/lessons/42578
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
function solution(clothes) {
let box = new Map();
let answer = 1;
for(let i =0 ; i < clothes.length; i++){
if(box.get(clothes[i][1])){
box.set(clothes[i][1],box.get(clothes[i][1])+1)
}else{
box.set(clothes[i][1],1);
}
}
for(let value of box.values()){
answer *= (value + 1);
console.log("값"+value)
console.log(answer)
}
return answer - 1;
}
'Vue > JavaScript 알고리즘' 카테고리의 다른 글
[JS 프로그래머스] 전화번호목록.해시 (0) | 2024.01.22 |
---|---|
[JS 프로그래머스] 폰켓몬.해시 (0) | 2024.01.21 |
[JS 프로그래머스] 완주하지못한 선수.해시 (0) | 2024.01.21 |
[JS 백준] 11652.카드 (0) | 2024.01.19 |
[JS 백준] 17298.오큰수 (0) | 2024.01.18 |