O(n) solution in Python 100% better
Intuition\n\n# Approach\n\n# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\no(n)\n# Code\n\nclass Solution(object):\n    def similarPairs(self, wo
# Intuition\n\n# Approach\n\n# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\no(n)\n# Code\n```\nclass Solution(object):\n    def similarPairs(self, words):\n        """\n        :type words: List[str]\n        :rtype: int\n        """\n        my_map = {}\n        for word in words:\n         unique_chars = frozenset(word)\n         if unique_chars in my_map:\n          my_map[unique_chars] += 1\n         else:\n          my_map[unique_chars] = 1\n        count=0\n        for key,value in my_map.items():\n            if value==1:\n                continue\n            while value!=0:\n                count+=value-1\n                value-=1\n        return count\n        \n```
['Python']