leetcode_119
Last updated
Was this helpful?
Last updated
Was this helpful?
In Pascal's triangle, each number is the sum of the two numbers directly above it.
Could you optimize your algorithm to use only O(k) extra space?
dynamic programming
To save the space used for recording the overriten pascal number in the last layer, we calculate from the end to the beginning.
Only a half of a certain layer needs to be calculated since numbers in each layer are symmetric.
math formula
reference: