[Python3] Solved using set Theory || easy but not efficient enough
Simple. If the length of union of two sets is equal to our tops lists length then we have a solution and finally we have to minimize our ans. Thats all!\n\n```\
Simple. If the length of union of two sets is equal to our tops lists length then we have a solution and finally we have to minimize our ans. Thats all!\n\n```\nclass Solution:\n    def minDominoRotations(self, tops: List[int], bottoms: List[int]) -> int:\n        t={}\n        b={}\n        n=len(tops)\n        for i in range(1,7):\n            t[i]=set()\n            b[i]=set()\n        for i in range(n):\n            t[tops[i]].add(i)\n        for i in range(n):\n            b[bottoms[i]].add(i)\n        ans=10**9\n        for i in range(1,7):\n            if len(t[i].union(b[i]))==n:\n                ans=min(ans,n-len(t[i]),n-len(b[i]))\n        if ans==10**9:\n            ans=-1\n        return ans\n
['Hash Table', 'Ordered Set']