1 class Solution: 2 def numEquivDominoPairs(self, dominoes: 'List[List[int]]') -> int: 3 n = len(dominoes) 4 dic = dict() 5 6 for do in dominoes: 7 key = () 8 if do[0] <= do[1]: 9 key = (do[0],do[1]) 10 else: 11 key = (do[1],do[0]) 12 if key in dic: 13 dic[key] += 1 14 else: 15 dic[key] = 1 16 pairs = 0 17 for k,v in dic.items(): 18 if v == 1: 19 pairs += 0 20 elif v == 2: 21 pairs += 1 22 else: 23 pairs += v * (v-1) // 2 24 return pairs
This title describes not clear, there are several topics read to understand, to own one kind of those exclusions.
Examples of some of the subjects should be more representative and reduce ambiguity.