[Programmers] 위장
Date:
[Programmers] 위장
Problem URL : 위장
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int solution(vector<vector<string>> clothes) {
unordered_map<string, int> um;
for(int i = 0; i < clothes.size(); i++) {
um[clothes[i][1]]++;
}
int answer = 1;
for (auto iter = um.begin(); iter != um.end(); iter ++) {
answer *= iter -> second + 1;
}
answer -= 1;
return answer;
}
댓글