Back
Close

Convert list of day to range of date

Statement

 Goal

convert list of each day to range of date
Input
9, 10, 20, 24, 28
Output
9-10, 20, 24, 28
Constraints
0 < N < 32
Example
Input
3, 11, 14, 18, 25, 26, 27
Output
3, 11, 14, 18, 25-27

Game modes
Fastest

Test cases
Test 1 Test
Input
3, 11, 14, 18, 25, 26, 27
Output
3, 11, 14, 18, 25-27

Validator 1 Validator
Input
18, 20, 22, 24, 29, 30, 31
Output
18, 20, 22, 24, 29-31

Test 2 Test
Input
1, 4, 6, 7, 14, 17, 19, 21, 27, 30, 31
Output
1, 4, 6-7, 14, 17, 19, 21, 27, 30-31

Validator 2 Validator
Input
1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 18, 20, 21, 23, 24, 25, 27, 28
Output
1, 3-11, 14-16, 18, 20-21, 23-25, 27-28

Test 3 Test
Input
3, 4, 6, 9, 10, 12, 14, 16, 17, 18, 20, 21, 22, 24, 25, 28, 29, 30, 31
Output
3-4, 6, 9-10, 12, 14, 16-18, 20-22, 24-25, 28-31

Validator 3 Validator
Input
1, 2, 3, 6, 8, 10, 11, 12, 14, 16, 18, 19, 21, 24, 25, 27, 28, 29, 30, 31
Output
1-3, 6, 8, 10-12, 14, 16, 18-19, 21, 24-25, 27-31

Test 4 Test
Input
18
Output
18

Validator 4 Validator
Input
3, 19, 22, 26
Output
3, 19, 22, 26

Test 5 Test
Input
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
Output
1-31

Validator 5 Validator
Input
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 24, 25, 26, 27
Output
9-18, 24-27

Solution language

Solution

Stub generator input