Python solution using O(k) space


#1

class Solution:
# @param A : integer
# @return a list of integers
def getRow(self, A):
Ans=[1]
for i in range(1,A+1):
Ans.append(1)
for j in range(i-1,0,-1):
Ans[j]=Ans[j-1]+Ans[j]
return Ans