[Python 3] Dictionary key is tuple of sorted set || beats 100% || 51ms 🥷🏼
python3 []\nclass Solution:\n    def similarPairs(self, words: List[str]) -> int:\n        d = defaultdict(int)\n        for n in words:\n            d[tuple(so
```python3 []\nclass Solution:\n    def similarPairs(self, words: List[str]) -> int:\n        d = defaultdict(int)\n        for n in words:\n            d[tuple(sorted(set(n)))] += 1\n\n        return sum(v * (v-1) // 2 for v in d.values())\n```\n![Screenshot 2023-07-28 at 21.01.45.png](https://assets.leetcode.com/users/images/fefd5433-38d2-4053-bf75-8be47f7a176f_1690567432.924887.png)\n
['Hash Table', 'Sorting', 'Ordered Set', 'Python', 'Python3']