题目描述
Given an index k, return the kth row of the Pascal’s triangle.
For example, given k = 3,
Return
[1,3,3,1].
本题k=0,返回[1]
解题
思路
每一行除了第0个元素和最后一个元素除外,current[j] = lastRow[j-1]+lastRow[j];
代码
|
酷爱历史文学的程序猿
Given an index k, return the kth row of the Pascal’s triangle.
For example, given k = 3,
Return
[1,3,3,1].
每一行除了第0个元素和最后一个元素除外,current[j] = lastRow[j-1]+lastRow[j];
|
微信打赏
支付宝打赏
热评文章