Pascal's Row
HardAcc. 75.6%
+45 XP 25
Combinatorial Flow
The k-th row of Pascal's triangle can be generated using a loop and simple multiplication.
Formula: $C(n, k) = C(n, k-1) \times (n-k+1) / k$.
The Assignment
Your function receives rowIndex.
- Print the elements of that row on new lines.
- The first and last elements are always 1.
01EXAMPLE 1
Input
rowIndex = 3Output
1
3
3
1Explanation: Row 3 of Pascal.
Constraints
- Iterative row generation.
MathArrays
JavaScriptSystem handles I/O — write your function only
Loading...
1 Hidden
Input Arguments
rowIndex3
Expected Output
1 3 3 1
Click RUN to test your solution