1128. Number of Equivalent Domino Pairs Easy
1/**
2 * [1128] Number of Equivalent Domino Pairs
3 *
4 * Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c and b == d), or (a == d and b == c) - that is, one domino can be rotated to be equal to another domino.
5 * Return the number of pairs (i, j) for which 0 <= i < j < dominoes.length, and dominoes[i] is equivalent to dominoes[j].
6 *
7 * Example 1:
8 *
9 * Input: dominoes = [[1,2],[2,1],[3,4],[5,6]]
10 * Output: 1
11 *
12 * Example 2:
13 *
14 * Input: dominoes = [[1,2],[1,2],[1,1],[1,2],[2,2]]
15 * Output: 3
16 *
17 *
18 * Constraints:
19 *
20 * 1 <= dominoes.length <= 4 * 10^4
21 * dominoes[i].length == 2
22 * 1 <= dominoes[i][j] <= 9
23 *
24 */
25pub struct Solution {}
26
27// problem: https://leetcode.com/problems/number-of-equivalent-domino-pairs/
28// discuss: https://leetcode.com/problems/number-of-equivalent-domino-pairs/discuss/?currentPage=1&orderBy=most_votes&query=
29
30// submission codes start here
31
32impl Solution {
33 pub fn num_equiv_domino_pairs(dominoes: Vec<Vec<i32>>) -> i32 {
34 0
35 }
36}
37
38// submission codes end
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43
44 #[test]
45 fn test_1128() {
46 }
47}
48
Back
© 2025 bowen.ge All Rights Reserved.