// Source : https://leetcode.com/problems/pascals-triangle
// Author : Dean Shi
// Date   : 2017-07-12

/***************************************************************************************
 *
 * Given numRows, generate the first numRows of Pascal's triangle.
 *
 * For example, given numRows = 5,
 * Return
 *
 * [
 *      [1],
 *     [1,1],
 *    [1,2,1],
 *   [1,3,3,1],
 *  [1,4,6,4,1]
 * ]
 *
 *
 ***************************************************************************************/

/**
 * @param {number} numRows
 * @return {number[][]}
 */
var generate = function(numRows) {
    const result = []

    for (let row, prevRow, i = 0; i < numRows; ++i) {
        [row, prevRow] = [[1], result[i - 1] || []]
        prevRow.forEach((n, j) => row.push(n + (prevRow[j + 1] || 0)))
        result.push(row)
    }
    return result
};

@@ -834,8 +834,350 @@
 sult%0A%7D;%0A
+%0A%0A/**%0A * @param %7Bnumber%7D numRows%0A * @return %7Bnumber%5B%5D%5B%5D%7D%0A */%0Avar generate = function(numRows) %7B%0A    const result = %5B%5D%0A%0A    for (let row = %5B%5D, i = 0; i %3C numRows; ++i) %7B%0A        row.push(1)%0A        for (let j = i - 1; j %3E 0; --j) %7B%0A            row%5Bj%5D = row%5Bj - 1%5D + row%5Bj%5D%0A        %7D%0A        result.push(row.slice())%0A    %7D%0A    return result%0A%7D;%0A

Update PascalsTriangle