Description
Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle.
In Pascal’s triangle, each number is the sum of the two numbers directly above it.
Example:
1 | Input: 5 |
解法
找到计算公式即可:
1 | if j == 0 or i == j: |
具体代码如下:
1 | class Solution { |