跟上一题一样,只是返回的值是指定的某一行
For example, given k = 3,
Return [1,3,3,1].
class Solution:
# @return a list of integers
def getRow(self, rowIndex):
rownum=rowIndex+1
currow=[1]
if rownum==1:
return currow
if rownum>0:
currow=[1]
for index in range(rownum):
prerow=currow
currow=[1]
for j in range(index-1):
currow.append(prerow[j]+prerow[j+1])
currow.append(1)
return currow