Daily Challenge (121 Part Series)
A format for expressing an ordered list of integers is to use a comma separated list of either:
- individual integers
- a range of integers denoted by the starting integer separated from the end integer in the range by a dash,
- the range includes all integers in the interval including both endpoints. It is not considered a range unless it spans at least 3 numbers. For example
12, 13, 15-17
Complete the solution so that it takes a list of integers in increasing order and returns a correctly formatted string in the range format.
solution([-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20])
Want to propose a challenge idea for a future post? Email firstname.lastname@example.org with your suggestions!
Throughout the last year, I have worked part-time as a working student and also studied at the university. I was not the first and not the last one who has combined that during their studies, but the problem for me was, that at the end of the day I have felt absolutely exhausted mentally and physically. That caused problems with my health and motivation to continue working on my goals or anything. (yeah, “goals,” I wish I had something more specific at that time).