```
/**
* @param {number} rowIndex
* @return {number[]}
*/
// const space solution
var getRow = function(rowIndex) {
const matrix = {};
for(let i = 0; i <= rowIndex; i += 1) {
matrix.response = Array(i + 1).fill(1);
for(let j = 1; j < i; j += 1) {
matrix.response[j] = matrix.previous[j - 1] + matrix.previous[j];
}
matrix.previous = matrix.response;
}
return matrix.response;
};
```