We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Sparse Arrays
- Discussions
Sparse Arrays
Sparse Arrays
Sort by
recency
|
361 Discussions
|
Please Login in order to post a comment
Are we supposed to assume that the query string is not a match even if it occurs as a substring of one of the search strings? As in, the full search string has to be a match for the full query string?
In that case, I would hope that would be stated clearly as part of the problem statement, rather than something you have to infer from the examples.
using hashmap 0(n) complexity
function matchingStrings(strings, queries) { let stringsHash = {}; let res = [];
}
using hashmap 0(n) complexity
function matchingStrings(strings, queries) { let stringsHash = {}; let res = [];
}
function matchingStrings(strings: string[], queries: string[]): number[] { return queries.reduce((prev, cur)=> [...prev, strings.filter((q)=>q===cur).length] , []); }