Ad
  • Default User Avatar

    In Python, at least, the built-in title method doesn't quite do the job here

  • Custom User Avatar

    I am not sure what exactly you mean by "partial messages", but there is this note in the description:

    NOTE: Extra spaces before or after the code have no meaning and should be ignored.

  • Custom User Avatar

    Doesn't it says at least 3 numbers there? Meaning three or more? IMHO you're saying the same, but I can be wrong and maybe one way of writing it is clearer than the other.

  • Custom User Avatar

    It is not considered a range unless it spans at least 3 numbers

    That means [1, 2, 4, 5, 6] is "1,2,4-6" and not "1-2,4-6".

    None of the consecutive elements at positions 0,1, and 2 differ by more than 1

    -10, -9 and -8 form this range: "-10--8". I think you're confusing what should be consecutive as a number and as an element in the list.

    solution([-10, -9, -8, -6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20]);
              |         |   |  |              |  |     |  |             |   |   |  |            |
              -----------   |  ----------------  -------  ---------------   |   |  --------------
                "-10--8   ,-6,         -3-1,       3-5,         7-11,      14, 15,      17-20"
    

    7-11 starts out well, 1 position after 3-5, but then it swallows a whole 5 numbers, and abandons 15.

    11 and 14 aren't consecutive numbers, so, obviously, the range ends in 11.

    The range 17-20 fortunately heralds the end of this hamster wheel of reasoning, but not before mysteriously consuming four numbers.

    There is no mistery there, it says at least 3 numbers, there can be more.

    I'd close this, because I think it all comes to your misunderstanding of the instructions, which are fine be me.

  • Custom User Avatar

    The goal is to group all numbers adjacent in the list which differ at most by 1. In your example of [-9, -8, -6], two last numbers do not differ by 1. If you have an idea for a better wording, feel free to suggest one.