https://github.com/a7bari/range-extraction-codewars
A format for expressing an ordered list of integers is to use a comma separated list of either
https://github.com/a7bari/range-extraction-codewars
Last synced: 7 months ago
JSON representation
A format for expressing an ordered list of integers is to use a comma separated list of either
- Host: GitHub
- URL: https://github.com/a7bari/range-extraction-codewars
- Owner: A7bari
- Created: 2021-12-19T12:13:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-19T12:49:13.000Z (almost 4 years ago)
- Last Synced: 2025-01-24T05:24:02.337Z (9 months ago)
- Language: C++
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Range-Extraction-Codewars
A format for expressing an ordered list of integers is to use a comma separated list of either- individual integers
- or 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.
# exemple
range_extraction({-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20});
// returns "-6,-3-1,3-5,7-11,14,15,17-20"# link :
https://www.codewars.com/kata/51ba717bb08c1cd60f00002f