The Pascal Architect
MediumAcc. 88.7%
+30 XP 12
The Nth Tier
In Pascal's Triangle, each number is the sum of the two numbers directly above it. Tier 0: 1 Tier 1: 1 1 Tier 2: 1 2 1 Tier 3: 1 3 3 1
The Assignment
Your function receives a parameter row.
- Use a loop to calculate each element of the
row-th row. - Use the combinatorial formula for each element
k:C(n, k) = C(n, k-1) * (n-k+1) / k. - Starting from 1, iterate through the row and print each value.
01EXAMPLE 1
Input
row = 3Output
1
3
3
1Explanation: Values of Tier 3.
Constraints
- Print each value on a new line.
- Use the iterative efficiency formula.
MathLoops
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
row3
Expected Output
1 3 3 1
Click RUN to test your solution