# [118. Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/description/)
# 思路
首先明白题目要求返回的是一个vector，其元素也是vector，按照题目规律构造每个vector即可。
# C++
``` C++
class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int> > result;
        for(int i = 0; i < numRows; i++){
            vector<int> tmp;
            tmp.push_back(1);
            for(int j = 1; j < i; j++){
                tmp.push_back(result[i-1][j-1] + result[i-1][j]);
            }
            if(i > 0) tmp.push_back(1);  
            result.push_back(tmp);
        }
        return result;  
    }
};
```
