标签:res map span object row amp self code win
Given an index k, return the kth row of the Pascal‘s triangle.
For example, given k = 3,
Return [1,3,3,1]
.
自己写的~~
1 class Solution(object): 2 def getRow(self, rowIndex): 3 """ 4 :type rowIndex: int 5 :rtype: List[int] 6 """ 7 8 res=[[1]] 9 for i in range(1,rowIndex+1): 10 res += [map(lambda x,y: x+y, res[-1]+[0], [0]+res[-1])] 11 return res[rowIndex]
for i in range(1,2): i 只能取到1
标签:res map span object row amp self code win
原文地址:http://www.cnblogs.com/fullest-life/p/6575572.html