Sparse Arrays

  • + 0 comments
    function matchingStrings(strings: string[], queries: string[]): number[] {
        return queries.map((q: string): number => strings.filter((s: string) => q === s).length)
    }