We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Help me in finding mistake in implementing your idea. As it is very slow in processing data. Please let me know if i can improve running time. The code is written in C#.
staticboolcheckwords(string[]mags,string[]rans){//Timing out : slower methodArray.Sort(mags);Array.Sort(rans);List<string>magList=mags.ToList();List<string>ranList=rans.ToList();//foreach (var s in ranList)for(inti=0;i<ranList.Count;i++){if(magList.Contains(ranList[i])){magList.Remove(ranList[i]);}else{returnfalse;}}returntrue;}
Cookie support is required to access HackerRank
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 →
Help me in finding mistake in implementing your idea. As it is very slow in processing data. Please let me know if i can improve running time. The code is written in C#.