Created
May 31, 2014 20:05
-
-
Save Ray1988/232ea516d750db3516ef to your computer and use it in GitHub Desktop.
Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
# @return a list of integers | |
def getRow(self, rowIndex): | |
if rowIndex<0: | |
return None | |
result=[0]*(rowIndex+1) | |
result[0]=1 | |
for i in range(1,len(result)): | |
result[i]=1 | |
for j in range(i-1, 0, -1): | |
result[j]=result[j]+result[j-1] | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment