3 ms·
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 t
by Pxtl 13y ago
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();