标签:
题目链接:https://leetcode.com/problems/pascals-triangle-ii/
题目:
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?
思路:
要求空间复杂度为O(k),其实只需要记录前一行的结果就可以了。
算法:
【Leetcode】Pascal's Triangle II
标签:
原文地址:http://blog.csdn.net/yeqiuzs/article/details/51628548