You are viewing a single comment's thread. Return to all comments →
vector<int> matchingStrings(vector<string> strings, vector<string> queries) { vector<int> ret; unordered_map<string, int> m; for (const string &s : strings) { m[s]++; } for (const string &q : queries) { if (m[q]) ret.push_back(m[q]); else ret.push_back(0); } return (ret); }
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
My Solution for C++ :