mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
feat(challenges): add consecutive-numbers
This commit is contained in:
parent
a630f6f7fb
commit
8eae4313a9
29
challenges/consecutive-numbers/README.md
Normal file
29
challenges/consecutive-numbers/README.md
Normal file
@ -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
challenges/consecutive-numbers/solutions/.gitkeep
Normal file
0
challenges/consecutive-numbers/solutions/.gitkeep
Normal file
6
challenges/consecutive-numbers/test/1/input.txt
Normal file
6
challenges/consecutive-numbers/test/1/input.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
7
|
||||||
|
1
|
||||||
|
2
|
||||||
|
5
|
||||||
|
3
|
||||||
|
4
|
2
challenges/consecutive-numbers/test/1/output.txt
Normal file
2
challenges/consecutive-numbers/test/1/output.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
1 ; 2
|
||||||
|
3 ; 4
|
0
challenges/consecutive-numbers/test/2/input.txt
Normal file
0
challenges/consecutive-numbers/test/2/input.txt
Normal file
0
challenges/consecutive-numbers/test/2/output.txt
Normal file
0
challenges/consecutive-numbers/test/2/output.txt
Normal file
4
challenges/consecutive-numbers/test/3/input.txt
Normal file
4
challenges/consecutive-numbers/test/3/input.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
1
|
||||||
|
4
|
||||||
|
3
|
||||||
|
5
|
0
challenges/consecutive-numbers/test/3/output.txt
Normal file
0
challenges/consecutive-numbers/test/3/output.txt
Normal file
4
challenges/consecutive-numbers/test/4/input.txt
Normal file
4
challenges/consecutive-numbers/test/4/input.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
1
|
||||||
|
4
|
||||||
|
5
|
||||||
|
3
|
1
challenges/consecutive-numbers/test/4/output.txt
Normal file
1
challenges/consecutive-numbers/test/4/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
4 ; 5
|
8
challenges/consecutive-numbers/test/5/input.txt
Normal file
8
challenges/consecutive-numbers/test/5/input.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
5
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
8
|
||||||
|
-5
|
||||||
|
-4
|
||||||
|
7
|
3
challenges/consecutive-numbers/test/5/output.txt
Normal file
3
challenges/consecutive-numbers/test/5/output.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
1 ; 2
|
||||||
|
2 ; 3
|
||||||
|
-5 ; -4
|
Loading…
Reference in New Issue
Block a user