You are viewing a single comment's thread. Return to all comments →
Solution for c#
public static void checkMagazine(List<string> magazine, List<string> note) { Dictionary<string, int> magazineDict = magazine.GroupBy(x => x) .ToDictionary(x => x.Key, g => g.Count()); foreach(string sNote in note){ if (magazineDict.ContainsKey(sNote) && magazineDict[sNote]>0) { magazineDict[sNote]--; } else { Console.WriteLine("No"); return; } } Console.WriteLine("Yes"); }
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →
Solution for c#