Ad
  • Custom User Avatar

    Already raised as issue a bucnh of messages below, so closing.

    Cheers.

  • Default User Avatar

    well, from the Example given: 7, 8, 9, 10, 11 will be replaced by 7-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 ?

  • Custom User Avatar

    Take a list and return a string of single numbers or ranges separated by commas, see the example.

  • Custom User Avatar

    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 is 1 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 ).

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Default User Avatar

    Python Hint: Pay attention how they are calling your code.

    ghost = Ghost()
    ghost.color
    

    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.

  • Default User Avatar

    You just need to return a list of lists :

    list_squared(42, 250) # returns [[42, 2500], [246, 84100]]