You are viewing a single comment's thread. Return to all comments →
C#:
Passed all Test cases:
static void checkMagazine(string[] magazine, string[] note) { int mg = magazine.Length; int nt = note.Length; Array.Sort(magazine); Array.Sort(note); int ctr = 0; int match = 0; while (ctr < mg && match < nt) { if(note[match] == magazine[ctr]){match++;} ctr++; } if(match == nt) {Console.WriteLine("Yes");} else {Console.WriteLine("No");} }
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 →
C#:
Passed all Test cases: