Sparse Arrays

  • + 0 comments

    Javascript Solution

    function sparseArrays(strings, queries) {
    
    	// Map the queries, for each query search for it in strings using the filter method, return the length to the return array
    	return queries.map(query => strings.filter(n => n == query).length);
    	
    }