Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Number of Equivalent Domino Pairs

XPChallenge Points: 10
levelLevel: Easy

Given a list of dominoes, where each domino is represented by two numbers [a, b],
two dominoes are equivalent if one can be rotated to match the other —
that is, (a == c and b == d) or (a == d and b == c).
Return the number of pairs (i, j) such that:
0 <= i < j < len(dominoes)
and dominoes[i] is equivalent to dominoes[j]

Example 1:

Input: dominoes = [[1,2],[2,1],[3,4],[5,6]]

Output: 1

Example 2:

Input: dominoes = [[1,2],[1,2],[1,1],[1,2],[2,2]]

Output: 3

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result