Skip to content

Practice Pascal's Triangle II

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#119
LeetCode Problem

Pascal's Triangle II

Problem Statement

Return row rowIndex of Pascal's triangle, using zero-based row numbering. Row 0 is [1]. Every row begins and ends with 1, and each interior entry adds the two adjacent entries above it. Follow-up: compute the requested row using O(rowIndex) additional space.

Source: Pascal's Triangle II on LeetCode. Use the original task for its coding environment and submissions.

Examples

# 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]

Constraints

0 <= rowIndex <= 33

Related LeetCode Problems

Practice more problems similar to Pascal's Triangle II.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.