How to delivery the value without use 'object link', and how to change the string to list


  • 0
    J

    class Solution:
    # @return a list of lists of integers
    def generate(self, numRows):
    if numRows == 0:
    return []
    r = [1]
    l = []
    l.append([1])
    for i in range(1,numRows):

            r.append(0)
            for j in range(1,i+1)[::-1]:
                r[j] = r[j] + r[j-1]
            l.append(str(r))
            
        return l

Log in to reply
 

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