My accepted python code with 38 ms


  • 0
    C
    def getRow(self, rowIndex):
        """
        :type rowIndex: int
        :rtype: List[int]
        """
        row = [1]
        for i in range (0, rowIndex):
            row = [1] + [row[j] + row[j+1] for j in xrange(len(row)-1)] + [1]
        return row

Log in to reply
 

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