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.
There is not much point fitting it all onto one line just because you can. It just makes your code harder to understand.
A minor optimisation could be to set j = i + 1, as to avoid some repeated comparisons, otherwise it looks good
Not every problem needs a hash table. The simplest solution is only 5 lines and it also just so happens to be the most intuitive and readable solution. Respect for the hash table implementation though!
Ignore the comments at the top haha. Was planning something else then forgot to delete them.
That's why they use the term interval, not a set, because it is not a set of integers (for which we can calculate a number of elements) but an interval of real numbers on the number line (which has a length). It get clearer when you get to the examples: interval [1, 5] has a length of 4 and a set {1, 2, 3, 4, 5} would have 5 elements.
It should be more clear that the interval [x, y] includes x, but not y. If you think of the problem in terms of sets, the set of the interval [x, y] = {x, x + 1, x + 2, ... , y - 2, y - 1}. Please correct me if I'm wrong.