We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8b45d0a commit 0aadd19Copy full SHA for 0aadd19
1 file changed
live8/test85/문제3/황장현.js
@@ -0,0 +1,28 @@
1
+function solution(clothes) {
2
+ let answer = 1;
3
+ const dic = {};
4
+
5
+ for (let i = 0; i < clothes.length; i++) {
6
+ const kind = clothes[i][1];
7
+ if (dic[kind] !== undefined) {
8
+ dic[kind] += 1;
9
+ } else {
10
+ dic[kind] = 1;
11
+ }
12
13
14
+ for (let k in dic) {
15
+ answer *= dic[k] + 1;
16
17
18
+ answer -= 1;
19
+ return answer;
20
+}
21
22
+console.log(
23
+ solution([
24
+ ['yellow_hat', 'headgear'],
25
+ ['blue_sunglasses', 'eyewear'],
26
+ ['green_turban', 'headgear'],
27
+ ])
28
+);
0 commit comments