def solution(clothes):
dic= dict()
for cloth in range(len(clothes)):
if clothes[cloth][1] not in dic:
dic[clothes[cloth][1]] = [clothes[cloth][0]]
else:
dic[clothes[cloth][1]].append(clothes[cloth][0])
val = len([item for values in dic.values() for item in values])
mul = 1
for v in dic.values():
mul = mul * len(v)
if len(dic.keys()) == 1:
return val
else:
return mul + val
정확성: 28.6
합계: 28.6 / 100.0
def solution(clothes):
dic= dict()
for cloth in range(len(clothes)):
if clothes[cloth][1] not in dic:
dic[clothes[cloth][1]] = 1
else:
dic[clothes[cloth][1]] += 1
items = list(dic.values())
answer = 1
for item in items:
answer = answer * (item + 1) # 각 item당 착용하지 않을 경우도 있기에 +1
answer -= 1 # 각 item을 모두 착용하지 않는것도( 위에서 계산되었기에 -1)
return answer
정확성: 100.0
합계: 100.0 / 100.0