mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-12-11 00:21:24 +01:00
fix(challenges): update consecutive-numbers
A little bit harder by having as input consecutive numbers needed to consider
This commit is contained in:
@@ -4,26 +4,42 @@ Created by [@Divlo](https://github.com/Divlo) on 28 June 2021.
|
||||
|
||||
## Instructions
|
||||
|
||||
Write a function which takes a list of integers, and which returns the (possibly empty) list of pairs of successive consecutive integers that there may be in the list.
|
||||
Write a function which takes a list of integers, and which returns the list of of successive consecutive integers that there may be in the list.
|
||||
|
||||
### Input
|
||||
|
||||
```txt
|
||||
7
|
||||
1
|
||||
2
|
||||
5
|
||||
3
|
||||
4
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```txt
|
||||
1, 2
|
||||
3, 4
|
||||
```
|
||||
First input, is the number of consecutive numbers needed to consider it as "consecutive", the second input is the list of integers.
|
||||
|
||||
## Examples
|
||||
|
||||
See the `test` folder for examples of input/output.
|
||||
|
||||
### Example 1
|
||||
|
||||
#### Input
|
||||
|
||||
```txt
|
||||
2
|
||||
5 ; 1 ; 2 ; 3 ; 8 ; -5 ; -4 ; 7
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
```txt
|
||||
1 ; 2
|
||||
2 ; 3
|
||||
-5 ; -4
|
||||
```
|
||||
|
||||
### Example 2
|
||||
|
||||
#### Input
|
||||
|
||||
```txt
|
||||
3
|
||||
5 ; 1 ; 2 ; 3 ; 8 ; -5 ; -4 ; 7
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
```txt
|
||||
1 ; 2 ; 3
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user