You are viewing a single comment's thread. Return to all comments →
Javascript solution
function matchingStrings(strings, queries) {
let freqObj = {} for(let i=0; i < strings.length; i++) { let str = strings[i]; freqObj[str] = (freqObj[str] || 0) + 1; } return queries.map(querie => freqObj[querie]) return queries.map(querie => freqObj[querie] || 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
function matchingStrings(strings, queries) {
}