Skip to content

Commit

Permalink
在I的基础上修改而来
Browse files Browse the repository at this point in the history
  • Loading branch information
rinwf committed Oct 3, 2018
1 parent 9e4944e commit adfb590
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lc119. Pascal's Triangle II.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
# if not rowIndex:
# return [1]
res = [1]
for i in range(1, rowIndex + 1):
tem = []
tem.append(1)
for j in range(1, i):
x = res[j] + res[j - 1]
tem.append(x)
tem.append(1)
res = tem
return res


num = 1
s = Solution()
print(s.getRow(num))

0 comments on commit adfb590

Please sign in to comment.