You are viewing a single comment's thread. Return to all comments →
A simple solution for C++: vector matchingStrings(vector strings, vector queries) { unordered_map strMp; vector ans; for (string s: strings) strMp[s]++; for (string s: queries) ans.push_back(strMp[s]); return ans;
}
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 →
A simple solution for C++: vector matchingStrings(vector strings, vector queries) { unordered_map strMp; vector ans; for (string s: strings) strMp[s]++; for (string s: queries) ans.push_back(strMp[s]); return ans;
}