• + 0 comments

    Javascript using ES6:

    function matchingStrings(stringList, queries) {
        return queries.reduce((acc, query) => {
            let occurrences = 0;
            
            stringList.forEach(string => {
                if (string === query) {
                    occurrences++;
                }
            });
            
            acc.push(occurrences);
            
            return acc;
        }, []);
    }