You are viewing a single comment's thread. Return to all comments →
C++ solution :
int gemstones(vector<string> arr) { map<char, int> m; int count=0; for (int i=0;i<arr.size();i++) for (int j=0;j<arr[i].size();j++) if (m[arr[i][j]]==i) m[arr[i][j]]=i+1; map<char, int>::iterator it=m.begin(); while(it!=m.end()) { if (it->second==arr.size()) count++; it++; } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
C++ solution :