Pascal's triangle starts with row 0 = [1]. Each entry is the sum of the two entries above it, and row r has r+1 entries which are the binomial coefficients C(r,0), C(r,1), ..., C(r,r).
Given a 0-indexed row number r, output that row.
One line: a non-negative integer r.
One line: the r+1 entries of row r, space-separated.
Example 1
Input
4
Expected
1 4 6 4 1
Explanation
Row 4 of Pascal's triangle is 1 4 6 4 1.
Example 2
Input
0
Expected
1
Explanation
Row 0 is just 1.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →