BRUTE FORCE || C++
Code\n\nclass Solution {\npublic:\n    int minDominoRotations(vector<int>& tops, vector<int>& bottoms) {\n        int n = tops.size(),i,j,k1=1,x1,k2,x2,ans;\n  
# Code\n```\nclass Solution {\npublic:\n    int minDominoRotations(vector<int>& tops, vector<int>& bottoms) {\n        int n = tops.size(),i,j,k1=1,x1,k2,x2,ans;\n        ans=n+10;\n        for(i = 1; i <= 6; i++){\n            k1 = 1,x1=0,k2=1,x2=0;\n            for(j = 0; j < n; j++){\n                if(tops[j]==i);\n                else if(bottoms[j]==i){\n                    x1++;\n                }else{\n                    k1 = 0;\n                }\n                if(bottoms[j]==i);\n                else if(tops[j]==i){\n                    x2++;\n                }else{\n                    k2 = 0;\n                }\n            }\n            // cout<<k1<<" "<<x1<<" "<<k2<<" "<<x2<<endl;\n            if(k1){\n                ans = min({ans,x1});\n            }if(k2){\n                ans = min(ans,x2);\n            }\n        }\n        return ans>n?-1:ans;;\n    }\n};\n```
['Array', 'Greedy', 'C++']