//这种也是空间复杂度为O(K)的解法,就是边界有点难写
class Solution {
public:
vector<int> getRow(int rowIndex) {
vector<int> res;
res.push_back();
if(rowIndex == ) return res;
res.push_back();
if(rowIndex == ) return res;
for(int i=;i <= rowIndex;i++){
res.push_back();
int a = res[];
int b = res[];
for(int j=;j < i;j++){
res[j] = a+b;
a = b;
b = res[j+];
}
res[i] = ;
}
return res;
}
};
相关文章
- 01-096 Candy_Leetcode
- 01-09LeetCode | HouseCode 算法题
- 01-09LeetCode-70 爬楼梯
- 01-09【leetcode❤python】 8. String to Integer (atoi)
- 01-09【leetcode❤python】Sum Of Two Number
- 01-09【leetcode❤python】 165. Compare Version Numbers
- 01-09【leetcode❤python】 168. Excel Sheet Column Title
- 01-09【leetcode❤python】 1. Two Sum
- 01-09[leetcode]80. Remove Duplicates from Sorted Array II有序数组去重(单个元素可出现两次)
- 01-09leetcode Search in Rotated Sorted Array python