Loading problem…
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.
Example 1
Input: numRows = 5
Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
Explanation: Each row starts and ends with 1, and every inner number is the sum of the two numbers above it. For example, the 6 in row 5 is 3 + 3 from row 4.
Example 2
Input: numRows = 1
Output: [[1]]
Explanation: The first row is just [1].
Example 3
Input: numRows = 2
Output: [[1],[1,1]]
Explanation: The first two rows are [1] and [1,1].
Each interior entry is the sum of the two entries directly above it; the ends are always 1.
Run checks all cases above. Submit evaluates all test cases.