News for hackers. Stuff that matters.
Re:LINQ Ruined My Favorite Interview Question by Pxtl on Thursday July 11, 2013 @10:44PM (#6030616)
Yeah, I tend to prefer the lambda notation over the sqlish notation, but either way the lambda form of your solution would be similarly terse. The select call that constructed an anonymous-typed object was unnecessary, as were all the temporary variables... C# coders should never be afraid to embrace the Rubyish leading dot approach.

  return s.Split(' ')
    .GroupBy(word => word)
    .OrderByDescending(wordGroup => wordGroup.Count())
    .Select(wordGroup => wordGroup.Key)
    .Take(10).ToList();

There are no comments on this comment yet.