Java 94% Time | 93% Memory Solution
Approach\n1. For each word I find whether a letter occured at least once. Then I make a key out of alphabet num array by composing String.\n2. Then I count how 
# Approach\n1. For each word I find whether a letter occured at least once. Then I make a key out of alphabet num array by composing String.\n2. Then I count how many times the key occured.\n3. Finally, I use arithmetic progression to count pairs for each key.\n\n# Code\n```\nclass Solution {\n    public int similarPairs(String[] words) {\n        int len = words.length;\n        if (len == 1) return 0;\n        byte[][] alph = new byte[len][26];\n        Map<String, Integer> map = new HashMap<>();\n        for (int i = 0; i < len; i++) {\n            String word = words[i];\n            for (char c : word.toCharArray()) {\n                int idx = c - \'a\';\n                if (alph[i][idx] == 0) alph[i][idx]++;\n            }\n            String s = new String(alph[i]);\n            if (map.containsKey(s)) {\n                map.put(s, map.get(s) + 1);\n            } else {\n                map.put(s, 1);\n            }\n        }\n        int pairs = 0;\n        //I use arithmetic progression here\n        for (String key : map.keySet()) {\n            int freq = map.get(key);\n            if (freq > 1) {\n                pairs += (freq * (freq - 1)) / 2;\n            }\n        }\n        return pairs;\n    }\n}\n```
['Java']