Problem
Problem page: https://leetcode.com/problems/pascals-triangle-ii/
Topics: Array
Difficulty: Easy
Similar problems: (E) Pascal's Triangle
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return[1,3,3,1].Note:
Could you optimize your algorithm to use only O(k) extra space?
Analysis
Another problem like Pascal's Triangle. This time we only need to return one row, not the whole triangle.
Code
1 | class Solution: |
Article link: https://xnerv.wang/en/leetcode-pascals-triangle-ii/
