Simple java solution
\n# Complexity\n- Time complexity: O(n^2)\n\n- Space complexity: O(1) as the array size is constant\n\n# Code\n\nclass Solution {\n    public int similarPairs(S
\n# Complexity\n- Time complexity: O(n^2)\n\n- Space complexity: O(1) as the array size is constant\n\n# Code\n```\nclass Solution {\n    public int similarPairs(String[] words) {\n        int m=0;\n        for(int i=0;i<words.length-1;i++)\n        {\n            for(int j=i+1;j<words.length;j++)\n            {\n                int a[]=new int[26];\n                int b[]=new int[26];\n                for(char c:words[i].toCharArray())\n                {\n                    a[c-\'a\']++;\n                }\n                for(char c:words[j].toCharArray())\n                {\n                    b[c-\'a\']++;\n                }\n                int k;\n                for(k=0;k<26;k++)\n                {\n                    if((a[k]==0 && b[k]!=0) || (a[k]!=0 && b[k]==0))\n                    {\n                        break;\n                    }\n                }\n                if(k==26)\n                {\n                    m++;\n                }\n            }\n        }\n        return m;\n    }\n}\n```
['Java']