mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-12-11 00:21:24 +01:00
feat(challenges): add consecutive-numbers
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
# consecutive-numbers
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### Input
|
||||||
|
|
||||||
|
```txt
|
||||||
|
7
|
||||||
|
1
|
||||||
|
2
|
||||||
|
5
|
||||||
|
3
|
||||||
|
4
|
||||||
|
```
|
||||||
|
|
||||||
|
### Output
|
||||||
|
|
||||||
|
```txt
|
||||||
|
1, 2
|
||||||
|
3, 4
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
See the `test` folder for examples of input/output.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
7
|
||||||
|
1
|
||||||
|
2
|
||||||
|
5
|
||||||
|
3
|
||||||
|
4
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
1 ; 2
|
||||||
|
3 ; 4
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
1
|
||||||
|
4
|
||||||
|
3
|
||||||
|
5
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
1
|
||||||
|
4
|
||||||
|
5
|
||||||
|
3
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
4 ; 5
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
5
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
8
|
||||||
|
-5
|
||||||
|
-4
|
||||||
|
7
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
1 ; 2
|
||||||
|
2 ; 3
|
||||||
|
-5 ; -4
|
||||||
Reference in New Issue
Block a user