Number of Equivalent Domino Pairs

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
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.
Return the number of pairs (i, j) for which 0 <= i < j < dominoes.length, and dominoes[i] is equivalent to dominoes[j].
LeetCode Problem - 1128
class Solution {
public int numEquivDominoPairs(int[][] dominoes) {
int count = 0; // Variable to store the number of equivalent domino pairs
// Iterate through each domino pair
for (int i = 0; i < dominoes.length; i++) {
int a = dominoes[i][0]; // First number of the current domino
int b = dominoes[i][1]; // Second number of the current domino
// Check the rest of the dominoes after the current one
for (int k = i + 1; k < dominoes.length; k++) {
int c = dominoes[k][0]; // First number of the comparison domino
int d = dominoes[k][1]; // Second number of the comparison domino
// Check if the two dominoes are equivalent
// Either (a, b) is the same as (c, d) or (a, b) is the same as (d, c)
if ((a == c && b == d) || (a == d && b == c)) {
count++; // Increment the count if they are equivalent
}
}
}
return count; // Return the total number of equivalent domino pairs
}
}




