https://programmers.co.kr/learn/courses/30/lessons/42890
from itertools import combinations
def check_duplicate(something):
old = []
checklist = [i for i in something if i not in old and not old.append(i) ]
return len(something) == len(checklist)
def solution(relation):
answer = 0
tmp = [i for i in range(len(relation[0]))]
print(tmp)
alters = []
for i in range(1,len(relation)):
alters.append(list(combinations(tmp,i)))
check = []
for alter in alters:
for a in alter:
temp = []
for row in relation:
temp.append([row[i] for i in a])
if check_duplicate(temp) == True:
for c in check:
if set(c).issubset(set(a)):
break
else:
check.append(a)
print(check)
return len(check)