Skip to content

Commit 0e00b59

Browse files
committed
feat(pascal): create README.md
1 parent fbc74a6 commit 0e00b59

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

19_pascal/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1-
# Exercise 17 - pascal
1+
# Exercise 19 - pascal
22

3-
Description of the exercise goes here.
3+
The pascal's triangle is modelled as follows:
4+
- The first row is `1`.
5+
- Each row can be considered to have a hidden `0` to either sides of it. So the first row could
6+
also be said to be `0, 1, 0`
7+
- To obtain the next row, we take each number and add it with its rightmost neighbor.
8+
9+
First row: `[1]`
10+
Second row: `[0+1, 1+0]` or simply `[1, 1]`
11+
Third row: `[0+1, 1+1, 1+0]` or simply `[1, 2, 1]`
12+
Fourth row: `[0+1, 1+2, 2+1, 1+0]` or simply `[1, 2, 2, 1]`
13+
...
14+
15+
The pattern continues forever.
16+
17+
Your task is to create a *recursive* function, `pascal` - that will take an input `n` and output the
18+
`n`th pascal's row.

0 commit comments

Comments
 (0)