Return the -th row of Pascal's Triangle using only the row index.
Pascals Triangle Ii
gfgGiven an integer rowIndex, return the rowIndex-th row of Pascal's Triangle (0-indexed).
In Pascal's Triangle, each number is the sum of the two numbers directly above it in the previous row. The first row is [1], the second row is [1, 1], and so on.
Build and return the requested row as a list of integers.
rowIndex representing the 0-indexed row to generate.rowIndex-th row of Pascal's Triangle.Example 1
Input
rowIndex = 3
Output
[1,3,3,1]
Explanation
The first four rows are [1], [1,1], [1,2,1], and [1,3,3,1].
Example 2
Input
rowIndex = 0
Output
[1]
Explanation
The 0-th row contains only one value.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.