61. Pascal’s triangle
Each row of Pascal’s triangle starts and ends with 1, and every other entry is the sum of the two entries above it. Write pascal n, the first n rows, from [1] downwards.
Examples
Input: pascal 1Output: [[1]]Input: pascal 5Output: [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
Submitting also runs 5 hidden tests.
Constraints
- 0 ≤ n ≤ 30.
pascal 0is the empty list.
Loading editor…
Type
\to in the editor, or click:Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.
ReadyLn 1, Col 1Lean 4
Draft saved in this browser