Pascal's Triangle

Easy · Dynamic Programming · about 10 minutes

Asked at Bloomberg, Microsoft, Amazon, Google, Meta, Apple.

Build Pascal's triangle with numRows rows. The first and last entry of each row is 1, and each entry in between is the sum of the two entries diagonally above it. Return the rows as lists.

Related guides