Python Super Simple & Easy O(n) Solution with explanations
\nclass Solution:\n    def minDominoRotations(self, A: List[int], B: List[int]) -> int:\n        domino = defaultdict(set)\n        min_domino_rotation = 20000\
```\nclass Solution:\n    def minDominoRotations(self, A: List[int], B: List[int]) -> int:\n        domino = defaultdict(set)\n        min_domino_rotation = 20000\n\t\t\n\t\t# initializing a dict to map between the value on a domino tile to all the tiles that have that value\n        for i in range(len(A)):\n            domino[A[i]] |= {i}\n            domino[B[i]] |= {i}\n            \n\t\t# find if a value exists on all domino tiles, if so we can do a rotation, check which value requires minimum number of rotations\n        for key in domino.keys():\n            if domino[key] == {index for index in range(len(A))}:\n                min_domino_rotation = min(len(A) - A.count(key), len(B) - B.count(key)) if min_domino_rotation > min(len(A) - A.count(key), len(B) - B.count(key)) else min_domino_rotation\n                    \n        return min_domino_rotation if min_domino_rotation < 20000 else -1\n```
['Python3']