CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2014
    Posts
    1

    Resolved 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.

  2. #2
    Join Date
    Aug 2014
    Posts
    6

    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
  •  





Click Here to Expand Forum to Full Width

Featured