Concise python solution using constant space


  • 0
    Y
    def getRow(self, k):
        res = []
        for i in range(0, k + 1):
            for j in reversed(range(1, len(res))):
                res[j] += res[j - 1]
            res += [1]
        return res

Log in to reply
 

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