You are viewing a single comment's thread. Return to all comments →
Swift solution:
func matchingStrings(strings: [String], queries: [String]) -> [Int] { queries.reduce(into: [Int]()) { partialResult, query in let occurrences = strings .filter { $0 == query } .count partialResult.append(occurrences) } }
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 →
Swift solution: