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