Simple 3 liner solution that beats 78% of runtime
\n\n# Code\n\nfunction similarPairs(words: string[]): number {\n    const sortedWords = words.map((word) => [...new Set(word)].sort().join());\n    const freque
\n\n# Code\n```\nfunction similarPairs(words: string[]): number {\n    const sortedWords = words.map((word) => [...new Set(word)].sort().join());\n    const frequency = new Map<string, number>();\n\n    return sortedWords.reduce((count, word) => {\n        const f = frequency.get(word) || 0;\n        count += f;\n        frequency.set(word, f+1);\n\n        return count;\n    }, 0);\n};\n```
['TypeScript', 'JavaScript']