APS/프로그래머스
[해시]위장
문래동까마귀
2021. 12. 18. 00:37
https://programmers.co.kr/learn/courses/30/lessons/42578
코딩테스트 연습 - 위장
programmers.co.kr
#include <string>
#include <vector>
#include <iostream>
#include <map>
using namespace std;
int solution(vector<vector<string>> clothes) {
int answer = 1;
map <string, int> myclothes;
for (int i = 0; i < clothes.size(); i++) {
myclothes[clothes[i][1]] += 1;
}
for (auto item : myclothes) {
answer *= (item.second + 1);
}
return answer - 1;
}