mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
27
leetcode/problem/number-of-equivalent-domino-pairs.html
Normal file
27
leetcode/problem/number-of-equivalent-domino-pairs.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>Given a list of <code>dominoes</code>, <code>dominoes[i] = [a, b]</code> is <strong>equivalent to</strong> <code>dominoes[j] = [c, d]</code> if and only if either (<code>a == c</code> and <code>b == d</code>), or (<code>a == d</code> and <code>b == c</code>) - that is, one domino can be rotated to be equal to another domino.</p>
|
||||
|
||||
<p>Return <em>the number of pairs </em><code>(i, j)</code><em> for which </em><code>0 <= i < j < dominoes.length</code><em>, and </em><code>dominoes[i]</code><em> is <strong>equivalent to</strong> </em><code>dominoes[j]</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> dominoes = [[1,2],[2,1],[3,4],[5,6]]
|
||||
<strong>Output:</strong> 1
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> dominoes = [[1,2],[1,2],[1,1],[1,2],[2,2]]
|
||||
<strong>Output:</strong> 3
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= dominoes.length <= 4 * 10<sup>4</sup></code></li>
|
||||
<li><code>dominoes[i].length == 2</code></li>
|
||||
<li><code>1 <= dominoes[i][j] <= 9</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user