You are viewing a single comment's thread. Return to all comments →
Agree. not sure what this "medium" difficulty quesion is aiming at.
Shorter description: Given an array of strings FOO and a an array of strings BAR find the count of string in BAR that occurs in FOO.
C#. Linq is your friend.
var results = new int[queries.Length];
var index = 0;
foreach (string s in queries)
results[index++] = strings.Where(i => i == s).Count();
public static int matchingStrings(string strings, string queries)
=> queries.Select(query => strings.Count(text => text == query))