Given an integer numRows, return the first numRows rows of Pascal's triangle. In Pascal's triangle each number is the sum of the two numbers directly above it, and every row starts and ends with 1.
Input / output
numRows: integernumRows lists, each row of the triangleExamples
numRows = 5 returns [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]].numRows = 1 returns [[1]].numRows = 2 returns [[1],[1,1]].Constraints
1 <= numRows <= 30Follow-up
Row k (0-indexed) is exactly the binomial coefficients C(k, 0..k). Can you generate each row from the previous one using only additions, without recomputing factorials?