풀었음.
https://school.programmers.co.kr/learn/courses/30/lessons/42578
import java.util.*;
class Solution {
public int solution(String[][] clothes) {
int answer = 1;
HashMap<String, Integer> hashmap = new HashMap<>();
for(int i=0; i<clothes.length; i++)
{
if(hashmap.containsKey(clothes[i][1]))
{
hashmap.put(clothes[i][1], hashmap.get(clothes[i][1])+1);
continue;
}
hashmap.put(clothes[i][1], 1);
}
for(var value : hashmap.keySet())
{
answer*=hashmap.get(value)+1;
}
return answer-1;
}
}
익힐것 :
1. HashMap
2. map.put
3. for(var value : hashmap.ketSet())