LeetCode p118 Pascal’s Triangle 题解
1.题目:
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]
]
题意:
按规律搭一个塔。
2.解题思路:
见代码
3.代码
1 |
|
很高兴遇见你~
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]
]
题意:
按规律搭一个塔。
见代码
1 |
|