This question evaluates combinatorics, array manipulation, and space-efficient algorithm design by requiring computation of a specific row of Pascal’s triangle without constructing the full triangle.
Given an integer rowIndex (0-indexed), return the rowIndex-th row of Pascal’s triangle.
Pascal’s triangle is defined as:
[1]
1
row[i][j] = row[i-1][j-1] + row[i-1][j]
rowIndex
: integer (
>= 0
)
rowIndex + 1
containing the values in that row.
0 <= rowIndex <= 10^5
rowIndex = 4
→
[1, 4, 6, 4, 1]