You are viewing a single comment's thread. Return to all comments →
Thank you kind sir, that's how tips should be passed on, inspired by your advice:
int gemstones(vector <string> arr){ set<char> occ; for (char c : arr.at(0)) { occ.insert(c); } for (int i=1; i<arr.size(); i++) { for (auto c : occ) { if (arr.at(i).find(c) == string::npos) { occ.erase(c); } } if (occ.size() == 0) break; } return occ.size(); }
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 →
Thank you kind sir, that's how tips should be passed on, inspired by your advice: