Skip to content

Commit

Permalink
위장 - level2
Browse files Browse the repository at this point in the history
  • Loading branch information
sey2 authored Aug 16, 2022
1 parent d9cb784 commit e1840d8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions programmers/Camouflage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
public int solution(String[][] clothes) {
int answer = 1;
HashMap<String, Integer> map = new HashMap<>();

for(int i=0; i<clothes.length; i++)
map.put(clothes[i][1], map.getOrDefault(clothes[i][1],0) + 1);

for(var num : map.values()){
answer *= num+1;
}

return answer-1;
}
}

0 comments on commit e1840d8

Please sign in to comment.