Created
March 21, 2017 15:45
-
-
Save mainroach/8d35fcb4cbc84927789a2cb03772f577 to your computer and use it in GitHub Desktop.
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
def pascalRowFast(rowIndex): | |
row=[0]*(rowIndex+1) | |
row[0] = row[rowIndex] = 1 | |
for i in range(0, rowIndex>>1): | |
x = row[ i ] * (rowIndex - i) / (i + 1) | |
row[ i + 1 ]= row[ rowIndex - 1 - i ] = x | |
return row |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment