class Solution: # @return a list of lists of integers def generate(self, numRows): lists =  for i in range(numRows): lists.append(*(i+1)) if i>1 : for j in range(1,i): lists[i][j]=lists[i-1][j-1]+lists[i-1][j] return lists
I am working on make my code pythonic and get the similar solution as follows:
resultset = [* (i+1) for i in range(numRows)] for i in range(numRows): for j in range(1, i): resultset[i][j] = resultset[i-1][j-1] + resultset[i-1][j] return resultset
@alagram it can also start the outer loop from 2. =D
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.