Description
Difficulty: Easy
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]
]
题意:
给出行数,生成相应行帕斯卡三角。
Solution
帕斯卡三角的下一行的某元素是上一行的相邻两元素的和。
|
|
Difficulty: Easy
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]
]
题意:
给出行数,生成相应行帕斯卡三角。
帕斯卡三角的下一行的某元素是上一行的相邻两元素的和。
|
|
近期评论