☑  C++ | Dominos  Clean Code. O(N)
\n   // this func returns min swaps to make a side (say X) equal. \n   int solveFunc(vector<int>& tops, vector<int>& bottoms) {\n        int n = tops.size();\n 
```\n   // this func returns min swaps to make a side (say X) equal. \n   int solveFunc(vector<int>& tops, vector<int>& bottoms) {\n        int n = tops.size();\n         int ans = INT_MIN;\n        unordered_map<int,int> mp1;\n        unordered_map<int,int> mp2;\n       \n        for(int i=0;i<n;i++) {\n            mp1[tops[i]]++;\n            if(tops[i]!=bottoms[i])\n                mp2[bottoms[i]]++;\n        }\n        \n        for(int i=1;i<=6;i++) {\n            int x = mp1[i] +mp2[i];\n            if(x==n) {\n                ans = mp2[i];\n                break;\n            }\n        }\n        \n        return ans;\n    }\n    \n    int minDominoRotations(vector<int>& tops, vector<int>& bottoms) {\n        \n        int ans1 = solveFunc(tops,bottoms);\n        int ans2 = solveFunc(bottoms,tops);\n        \n        int res = min(ans1,ans2);\n    \n        return (res==INT_MIN?-1:res);\n    }\n```
['C']