118. Pascal's Triangle

Easy

9.6K

311

Given an integer `numRows`

, return the first numRows of **Pascal's triangle**.

In **Pascal's triangle**, each number is the sum of the two numbers directly above it as shown:

**Example 1:**

Input:numRows = 5Output:[[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]

**Example 2:**

Input:numRows = 1Output:[[1]]

**Constraints:**

`1 <= numRows <= 30`

Accepted

1.2M

Submissions

1.7M

Acceptance Rate

70.7%

Seen this question in a real interview before?

1/4

Yes

No

Discussion (0)

Related Topics

Copyright ©️ 2023 LeetCode All rights reserved