Tap here to switch tabs
Problem
Submissions

Problem: Pascal’s Triangle

Pascal’s Triangle gives you the number of rows to generate. Return the triangle starting with a single one, with ones at each row’s edges and interior values formed by adding neighbors above.

Statement

Given an integer, numRows, generate the first numRows of Pascal’s triangle.

In Pascal’s triangle, each element is formed by adding the two numbers directly above it from the previous row. The triangle starts with a single 11 at the top, and each row expands based on this rule.

Constraints:

  • 1 ≤\leq numRows ≤\leq 3030

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Pascal’s Triangle

Pascal’s Triangle gives you the number of rows to generate. Return the triangle starting with a single one, with ones at each row’s edges and interior values formed by adding neighbors above.

Statement

Given an integer, numRows, generate the first numRows of Pascal’s triangle.

In Pascal’s triangle, each element is formed by adding the two numbers directly above it from the previous row. The triangle starts with a single 11 at the top, and each row expands based on this rule.

Constraints:

  • 1 ≤\leq numRows ≤\leq 3030