[LeetCode]杨辉三角 II

题目

 

代码 

class Solution {
public:
    vector<int> getRow(int rowIndex) {
        vector<int> array(rowIndex+1);
        for(int i=0;i<=rowIndex;i++){
          for (int j = i - 1; j > 0; j--){ 
              array[j] = array[j - 1] + array[j];
          }
          array[i]=1;

        }
        return array;

    }
};
原文地址:https://www.cnblogs.com/lizhenghao126/p/11053573.html