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.
Already raised as issue a bucnh of messages below, so closing.
Cheers.
well, from the Example given:
7, 8, 9, 10, 11
will be replaced by7-11
because it spans at least 3 numbers (here there are 5 numbers).Meanwhile,
14, 15
would not be replaced since it spans only 2 numbers.Try to reproduce the Example given, on pen and paper, using the description? Are you able to do it?
Can you get the answer for example:
1, 2, 3, 15, 16, 45, 98, 99, 100, 101, 102
?Take a list and return a string of single numbers or ranges separated by commas, see the example.
Because its runtime scales with the square of the number of elements. Doing something
400 000 000
times can still be fast ( CPUs run at GHZ speeds ). Now feed it a million elements. A million squared is1 000 000 000 000
. That will take ( too much ) time.You'll need something that scales better. Tests use arguments up to
100 000
long ( in JS, but I guess Python will do similar ).This comment is hidden because it contains spoiler information about the solution
Python Hint: Pay attention how they are calling your code.
You have to come up with a simple class which has init and an attribute called color.
If the problem is still unclear for you, try reading about the basics of classes.
You just need to return a list of lists :