Open fly0o0 opened 4 years ago
/**
* [
* [1],
* [1,1],
* [1,2,1],
* [1,3,3,1],
* [1,4,6,4,1]
* ]
* @param {number} rowIndex
* @return {number[]}
*/
var getRow = function(rowIndex) {
let kRow = []
for (let i = 0; i < rowIndex; i++) {
kRow[0] = 1
kRow[i] = 1
for (let j = i - 1; j > 0; j--) {
kRow[j] = kRow[j - 1] + kRow[j]
}
}
return kRow
};