problem
1128. Number of Equivalent Domino Pairs
solution1:
不明白为什么每个元素都要加上count;
class Solution { public: int numEquivDominoPairs(vector<vector<int>>& dominoes) { int res = 0; unordered_map<int, int> count; for(auto d:dominoes) { res += count[min(d[0], d[1])*10+max(d[0], d[1])]++; } return res; } };
参考
1. Leetcode_easy_1128. Number of Equivalent Domino Pairs;
2. Discuss;
完