Python simple and easy intuitive explained solution
\nclass Solution:\n    def minDominoRotations(self, A: List[int], B: List[int]) -> int:\n        def countDifference(A, B, num):\n            countA, countB = 0
```\nclass Solution:\n    def minDominoRotations(self, A: List[int], B: List[int]) -> int:\n        def countDifference(A, B, num):\n            countA, countB = 0, 0\n            \n            for i in range(len(A)):\n                # if we have a domino which doesn\'t have num at all, num can\'t be the whole row:\n                if A[i] != num and B[i] != num:\n                    return -1\n                else:\n                    if A[i] != num: countA+=1\n                    if B[i] != num: countB+=1\n    \n            return min(countA, countB)\n        \n        # check if A[0] and B[0] can\'t be the number for the whole row:\n        if A.count(A[0]) + B.count(A[0]) < len(A) and A.count(B[0]) + B.count(B[0]) < len(A):\n            return -1\n        \n        # first try to make A[0] the whole row, then try B[0]:\n        res1 = countDifference(A, B, A[0])\n        res2 = countDifference(A, B, B[0])\n        \n        if min(res1, res2) > 0: return min(res1, res2)\n        return max(res1, res2)\n```\n**Like it? please upvote...**
['Python3']