Skip to content

Commit

Permalink
py implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Azureki committed Jul 21, 2019
1 parent 43bb59a commit e0968ef
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 1128. Number of Equivalent Domino Pairs/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from collections import defaultdict


class Solution:
def numEquivDominoPairs(self, dominoes: List[List[int]]) -> int:
d = defaultdict(int)
for domino in dominoes:
d[tuple(sorted(domino))] += 1
return sum([value*(value-1) for value in d.values()])

0 comments on commit e0968ef

Please sign in to comment.