Simple Python-7lines


  • 0
    U
    class Solution(object):   
        def generate(self, numRows):
            L=[1]
            PL=[]
            for j in range(numRows):
                PL.append(L[::-1])
                L.append(0)
                L = [L[i-1]+L[i] for i in range(len(L))]
            return PL
               
    

Log in to reply
 

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