Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Very nice. This is as close to an "objectively correct" solution as I can think. Proper use of relatively obscure built-in methods for which this problem is a textbook use case example.
Given that most LINQ extension methods do use lazy evaluation, the first option seems more likely. And it actually is the one MS uses in their reference implementation as well: https://referencesource.microsoft.com/#System.Core/System/Linq/Enumerable.cs,836
Well, the standard way to implement Distinct() on an IEnumerable<> would be to use a HashSet, with two variations: 1) use it strictly as a test (
if (hs.Add(item)) yield return item
), or 2) read the entire enumerable in to the HashSet, and then iterator thru the set. The first method would be stable; the second, not necessarily.You're correct as far as the documentation saying that it's "unordered", and other providers are technically free to implement it in another way, but when dealing with a stable data structure such as a string, in a single-threaded context, in a lazily-evaluated LINQ chain, there is simply no other efficient way to yield the items from the enumerable than the original sequence. The only other way is to consume the entire thing and sort it and eliminate duplicates that way, but that both takes more immediate memory and delays the pipeline, so it's unlikely this implementation would change. There might be a theoretical potential for very large data sets to implement some sort of parallel distributed Distinct which then merges the sets at the end, and in that case order might not be preserved, but I'm not sure if that's performant, and in any case we don't use
.AsParallel()
here, so that's not an option either.tl;dr: It may be undocumented behavior, but it's very predictable undocumented behavior in this particular case.
No need to put a whitespace into Split(). Works by default that way.
This comment is hidden because it contains spoiler information about the solution
Amazing!
my solution is tricky haha
This is funny
Wow! xD
Yes, here and in the homepage.
I am confused, can you see the comments on solutions without being able to see the solution?
Spoiler flag, please.
This comment is hidden because it contains spoiler information about the solution
I really thought I was gonna be the only one with this solution, haha
Loading more items...