Note:
 Memo precalculated result makes it faster.
Question:
Given an integer rowIndex
, return the rowIndexth
(0indexed) row of the Pascal’s triangle.
In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown:
Example:
1 2
 Input: rowIndex = 3 Output: [1,3,3,1]

Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

var getRow = function (rowIndex) { let triangle = []; for (let i = 0; i <= rowIndex; i++) { triangle.push([...Array(i + 1).fill(1)]); } if (rowIndex <= 1) return triangle[rowIndex]; for (let i = 2; i <= rowIndex; i++) { let arr = triangle[i]; let lastArr = triangle[i  1]; for (let j = 1; j < arr.length  1; j++) { arr[j] = lastArr[j] + lastArr[j  1]; } } return triangle[rowIndex]; };
