simple C++, easy to read
Check first value of both arrays, then check if either value can be the answer.  Return minimum # rotates if so.\n\n\nclass Solution {\npublic:\n    int minDomi
Check first value of both arrays, then check if either value can be the answer.  Return minimum # rotates if so.\n\n```\nclass Solution {\npublic:\n    int minDominoRotations(vector<int>& A, vector<int>& B)\n    {\n        int a = A[0];\n        int b = B[0];\n        int numRotates = getNumRotates(A, B, a);\n        return (numRotates != -1) ? numRotates : getNumRotates(A, B, b);\n    }\n\n    int getNumRotates(vector<int>& A, vector<int>& B, int a)\n    {\n        int numARotates = 0;\n        int numBRotates = 0;\n\n        // check if a is the answer, tracking rotate\n        for (int i=0; i<A.size(); i++)\n        {\n            if (A[i] != a && B[i] != a)\n            {\n                numARotates = -1;  // We know this will be returned cause it will be the min value\n                break;\n            }\n            else if (A[i] != a)\n            {\n                numARotates++;\n            }\n            else if (B[i] != a)\n            {\n                numBRotates++;\n            }\n        }\n        return std::min(numARotates, numBRotates);\n    }\n\n};\n```
['C', 'C++']