-
August 12th, 2014, 03:02 PM
#1
C# interview question
Can anybody help to code this out?
Given a dictionary of words
And user entered word to compare against
When comparing the given word against the dictionary
Then output all words in the dictionary that exist in the given word
E.g. StartBurst would output Star and Burst if those words were in the dictionary.
-
September 2nd, 2014, 06:23 AM
#2
Re: C# interview question
used .NET 4.5
var myDictionary = new List<string>{ "Star", "Burst", "Something", "Other"};
var myWord = "StarBurst";
var containingWords = myDictionary.Where(w => myWord.Contains(w)).ToList();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|