simple python solution


  • 0
    A
    class Solution(object):
        def getRow(self, rowIndex):
            """
            :type rowIndex: int
            :rtype: List[int]
            """
            if rowIndex==0:
                return [1]
       
            res=[0] * (rowIndex+1)
            res[0]=1
            for i in range(1,rowIndex+1):
                for j in range(i,0,-1):
                    res[j]+=res[j-1]
            
            return res
            
            
            
            
            
            
    
    

Log in to reply
 

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