My simple Python solution


  • 4
    B
    class Solution(object):
        def getRow(self, rowIndex):
            row = [1]
            for i in range(1, rowIndex + 1):
                row = [1] + [ row[x] + row[x - 1] for x in range(1, i)] + [1]
            return row

Log in to reply
 

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