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.
- Prepare
- Data Structures
- Arrays
- Sparse Arrays
- Discussions
Sparse Arrays
Sparse Arrays
Sort by
recency
|
2389 Discussions
|
Please Login in order to post a comment
Creating a defaultdict makes this one pretty easy.
` from collections import defaultdict
def matchingStrings(stringList, queries): hm = defaultdict(int) for key in stringList: hm[key] += 1 return [hm[key] for key in queries] `
javascript
c++ C++ cpp
int main() { vector str = {"aba", "baba", "aba", "xzxb"}; vector query = {"aba", "xzxb", "ab"}; vector a; int counter=0;
function matchingStrings(stringList, queries) { // Write your code here
}
go