vector<vector<int>> generate(int num) { vector<vector<int>> result; vector<int> array; for (int i = 1; i <= num; i++) { for (int j = i - 2; j > 0; j--) { array[j] = array[j - 1] + array[j]; } array.push_back(1); result.push_back(array); } }