bitmask | hashmap | O(n*m)
Intuition\n Describe your first thoughts on how to solve this problem. \nwe can do it with various approaches.\n\nlike store characters that occured in boolean 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nwe can do it with various approaches.\n\nlike store characters that occured in boolean vector and a map to store it\'s count.\n\nas of i know for strings we can use freq vector as it is easy to compare two vectors rather than array.\n\nbut we can also use bitmasking to mark the one which are visited.\n\ndifference comes in SC in using int vs vector to store visited characters.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nSimple for each first store the present characters.\nCheck if it is present already in previous part.\n\nDry run if facing issue in thinking that if previous elements are taken care of then how would upcoming elements will be taken care of.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n*m) n is length of given string vector.\nlet m is average length of strings in it.\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nHere is where the difference comes.\nvector vs int \n# Code\n```\nclass Solution {\npublic:\n    int similarPairs(vector<string>& w) {\n\n        // lets try to do it with bitmasking\n\n        int n = w.size();\n\n        unordered_map<int, int> ump;\n\n        int cnt = 0;\n\n        for(int i=0; i<n; i++){\n            string temp = w[i];\n\n            int vis = 0;\n            for(auto j:temp){\n                vis |= (1<<(j-\'a\'));\n            }\n\n            if(ump.find(vis)!=ump.end()){\n                cnt += ump[vis];\n            }\n            ump[vis]++;\n        }\n\n        return cnt;\n    }\n};\n```
['C++']