Python | O(nlogn)
Approach\n- we can process each string in following manner:\n    - convert string into list of characters.\n    - convert it into set to get unique characters.\
# Approach\n- we can process each string in following manner:\n    - convert string into list of characters.\n    - convert it into set to get unique characters.\n    - agin convert it into list and sort them.\n    - now join all the characters to make string.\n- In this way we will have all atrings with unique and sorted characters.\n- Now we can make frequency dictionary of each string.\n- apply the formula n*(n-1)/2 to get number of pairs formed by n same strings.\n\n\n# Complexity\n- Time complexity: O(nlogn)\n\n- Space complexity: O(n)\n\n# Code\n```\nclass Solution:\n    def similarPairs(self, words: List[str]) -> int:\n        words = ["".join(sorted(list(set(list(i))))) for i in words]\n        d = {}\n        for word in words:\n            d[word] = d.get(word, 0)+1\n        count = 0\n        for k in d:\n            count += ((d[k]*(d[k]-1))//2)\n        return count\n```\n-------------------\n- Upvote the post if you find it helpful.\nHappy coding.
['Python3']