Submissions disabled: This deployment is running in read-only mode for safety. Code execution is not available here.
← Back to all problems
Easy

Pascal Triangle Row

Updated Jan 31, 2026

Problem

Given a row number n (0-indexed), return the nth row of Pascal's triangle.

Pascal's triangle starts with 1 at the top. Each number in a row is the sum of the two numbers directly above it.

Row 0: 1
Row 1: 1 1
Row 2: 1 2 1
Row 3: 1 3 3 1
Row 4: 1 4 6 4 1

Output the numbers in the row, space-separated.

Constraints

0 <= n <= 33

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]

Function Signature

def getRow(self, rowIndex: int) -> list[int]

How to Submit

Implement a Solution class with a getRow method.

Your method will be called with the input parameters and should return the answer.