Easy

Quiz

#119 Pascal's Triangle II

APPROACH

Given a 0-indexed row number rowIndex, return that row of Pascal's triangle as a list.

In Pascal's triangle, each element is the sum of the two elements directly above it.

Example 1:

Input: rowIndex = 3
Output: [1,3,3,1]

Example 2:

Input: rowIndex = 0
Output: [1]

Example 3:

Input: rowIndex = 1
Output: [1,1]
1 of 4
1:00

What is the optimal approach for this problem?