You are viewing a single comment's thread. Return to all comments →
python solution 2 types 1) nested for loops
def matchingStrings(strings, queries): # Write your code here result = [] for q in queries: count = 0 for s in strings: if q == s: count+=1 result.append(count) return result
2)using count function
def matchingStrings(strings, queries): # Write your code here result = [] for q in queries: result.append(strings.count(q)) return result
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
python solution 2 types 1) nested for loops
2)using count function