Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.


In Pascal's triangle, each number is the sum of the two numbers directly above it.

Example:

Input: 5
Output:
[
     [1],
    [1,1],
   [1,2,1],
  [1,3,3,1],
 [1,4,6,4,1]
]

 基础的题,就是后面的等于(上面+左上)

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> v;
        for(int i=0;i<numRows;i++){
            vector<int>v2;
            v2.push_back(1);
            for(int l=1;l<i;l++){
                v2.push_back(v[i-1][l-1]+v[i-1][l]);
            }if(i>0)v2.push_back(1);
            v.push_back(v2);
        }return v;
    }
};