还是注意下标
class Solution {public: vector<int> getRow(int rowIndex) { vector<int>ve (rowIndex + 1, 1); int a = 1, b = 1; if(rowIndex == 0 || rowIndex == 1) return ve; for(int i = 3; i <= rowIndex + 1; ++ i){ for(int j = 2; j <= i - 1; ++ j){ ve[j - 1] = a + b; a = b; b = ve[j]; } a = ve[0]; b = ve[1]; } return ve; }};新闻热点
疑难解答