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.

  1. Use a loop to calculate each element of the row-th row.
  2. Use the combinatorial formula for each element k: C(n, k) = C(n, k-1) * (n-k+1) / k.
  3. Starting from 1, iterate through the row and print each value.

01EXAMPLE 1

Inputrow = 3
Output1 3 3 1

Explanation: Values of Tier 3.

Constraints

  • Print each value on a new line.
  • Use the iterative efficiency formula.
MathLoops
JavaScript
Loading...
3 Hidden

Input Arguments

row3

Expected Output

1
3
3
1

Click RUN to test your solution