Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

def getRow(rowIndex): pascal = [1]*(rowIndex + 1) for i in range(2,rowIndex+1): for j in range(i-1,0,-1): pascal[j] += pascal[j-1] return pascal

avoid range(... , ... , -1) will make the program run faster

def getRow(rowIndex): rt=[1]*(rowIndex+1) for i in range(2, rowIndex+1): for j in range(1, i): rt[i-j]+=rt[i-j-1] return rt

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.