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.
Nope))
Unfortunately, this code is neither efficient nor clean.
As far as performance is concerned method contains has a high cost when you are dealing with a list.
A possible remedy to this problem: maintain a set of values that are already seen, which will improve time complexity but requires additional space as well
(if you want to see an example look at my fork to this solution).
it's in the title: consecutive numbers. ;p
Why? Its still O(n).