You are viewing a single comment's thread. Return to all comments →
JavaScript solution:
function matchingStrings(strings, queries) { const counts = new Map(); strings.forEach(string => { const existingCount = counts.get(string); if (existingCount) { counts.set(string, existingCount + 1); } else { counts.set(string, 1); } }) return queries.map(query => counts.get(query) || 0); }
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 →
JavaScript solution: