mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
feat(challenges): add triangle-type
This commit is contained in:
parent
b3f558b862
commit
b045c70c1a
20
challenges/triangle-type/README.md
Normal file
20
challenges/triangle-type/README.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# triangle-type
|
||||||
|
|
||||||
|
Created by [@Divlo](https://github.com/Divlo) on 30 June 2021.
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
|
||||||
|
Given the lengths of the 3 sides of a triangle, your function should return whether it is `equilateral`, `isosceles`, `scalene` or `impossible`.
|
||||||
|
|
||||||
|
- A triangle is `equilateral` when its 3 sides are equal
|
||||||
|
- A triangle is `isosceles` when 2 of its sides are equal
|
||||||
|
- A triangle is `scalene` when none of its sides is equal to another side
|
||||||
|
- A triangle is `impossible` when the sum of two of its sides is strictly less than the third side
|
||||||
|
|
||||||
|
## Input
|
||||||
|
|
||||||
|
- **Line 1 to 3:** The length of each side of the triangle
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
See the `test` folder for examples of input/output.
|
0
challenges/triangle-type/solutions/.gitkeep
Normal file
0
challenges/triangle-type/solutions/.gitkeep
Normal file
3
challenges/triangle-type/test/1/input.txt
Normal file
3
challenges/triangle-type/test/1/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
2
|
||||||
|
2
|
||||||
|
2
|
1
challenges/triangle-type/test/1/output.txt
Normal file
1
challenges/triangle-type/test/1/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
equilateral
|
3
challenges/triangle-type/test/10/input.txt
Normal file
3
challenges/triangle-type/test/10/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
7
|
||||||
|
3
|
||||||
|
2
|
1
challenges/triangle-type/test/10/output.txt
Normal file
1
challenges/triangle-type/test/10/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
impossible
|
3
challenges/triangle-type/test/11/input.txt
Normal file
3
challenges/triangle-type/test/11/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
10
|
||||||
|
1
|
||||||
|
3
|
1
challenges/triangle-type/test/11/output.txt
Normal file
1
challenges/triangle-type/test/11/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
impossible
|
3
challenges/triangle-type/test/12/input.txt
Normal file
3
challenges/triangle-type/test/12/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
97
|
||||||
|
97
|
||||||
|
97
|
1
challenges/triangle-type/test/12/output.txt
Normal file
1
challenges/triangle-type/test/12/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
equilateral
|
3
challenges/triangle-type/test/2/input.txt
Normal file
3
challenges/triangle-type/test/2/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
10
|
||||||
|
10
|
||||||
|
10
|
1
challenges/triangle-type/test/2/output.txt
Normal file
1
challenges/triangle-type/test/2/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
equilateral
|
3
challenges/triangle-type/test/3/input.txt
Normal file
3
challenges/triangle-type/test/3/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
3
|
||||||
|
4
|
||||||
|
4
|
1
challenges/triangle-type/test/3/output.txt
Normal file
1
challenges/triangle-type/test/3/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
isosceles
|
3
challenges/triangle-type/test/4/input.txt
Normal file
3
challenges/triangle-type/test/4/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
4
|
||||||
|
3
|
||||||
|
4
|
1
challenges/triangle-type/test/4/output.txt
Normal file
1
challenges/triangle-type/test/4/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
isosceles
|
3
challenges/triangle-type/test/5/input.txt
Normal file
3
challenges/triangle-type/test/5/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
10
|
||||||
|
10
|
||||||
|
2
|
1
challenges/triangle-type/test/5/output.txt
Normal file
1
challenges/triangle-type/test/5/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
isosceles
|
3
challenges/triangle-type/test/6/input.txt
Normal file
3
challenges/triangle-type/test/6/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
1
challenges/triangle-type/test/6/output.txt
Normal file
1
challenges/triangle-type/test/6/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
scalene
|
3
challenges/triangle-type/test/7/input.txt
Normal file
3
challenges/triangle-type/test/7/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
1
challenges/triangle-type/test/7/output.txt
Normal file
1
challenges/triangle-type/test/7/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
scalene
|
3
challenges/triangle-type/test/8/input.txt
Normal file
3
challenges/triangle-type/test/8/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
5
|
||||||
|
4
|
||||||
|
2
|
1
challenges/triangle-type/test/8/output.txt
Normal file
1
challenges/triangle-type/test/8/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
scalene
|
3
challenges/triangle-type/test/9/input.txt
Normal file
3
challenges/triangle-type/test/9/input.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
1
|
||||||
|
1
|
||||||
|
3
|
1
challenges/triangle-type/test/9/output.txt
Normal file
1
challenges/triangle-type/test/9/output.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
impossible
|
Loading…
Reference in New Issue
Block a user