728x90
반응형
Input = [ [1,3] , [4,3], [4,10] ]
def solution(v):
tmp = dict()
for i in v :
if i[0] in tmp:
tmp[i[0]].append(i[1])
else:
tmp[i[0]]=[i[1]]
k = list( tmp.keys() )
if len( tmp[k[0]]) > len( tmp[k[1]]) :
answer= [k[1]]
for i in tmp[k[0]] :
if i not in tmp[k[1]]:
answer.append( i )
else:
answer= [k[0]]
for i in tmp[k[1]] :
if i not in tmp[k[0]]:
answer.append( i )
return answer
728x90
반응형