dsa · easy
Pascal's Triangle II
Return row row_index of Pascal’s triangle. Rows are 0-based: row 0 is [1], row 1 is [1, 1], and each later row starts and ends with 1 with interior entries equal to the sum of the two entries above.
Arguments
row_index— 0-based index of the Pascal row to return
Example
row_index = 3.
Row 0 [1] → row 1 [1, 1] → row 2 [1, 2, 1] → row 3 interiors 1+2=3 and 2+1=3 → [1, 3, 3, 1].
Constraints
0 <= row_index <= 33
Examples
Example 1
Input: 3 Expected: [1,3,3,1]
Example 2
Input: 0 Expected: [1]