다음과 같은 Pascal's Triangle 결과를 출력하기
Input: numRows = 5
Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
https://leetcode.com/problems/pascals-triangle/
int** generate(int numRows, int* returnSize, int** returnColumnSizes){
int **ret = (int **)malloc(sizeof(int *) * numRows);
*returnColumnSizes = (int *)calloc(numRows, sizeof(int));
*returnSize = numRows;
for (int i = 0; i < numRows; i++) {
ret[i] = (int *)malloc(sizeof(int) * (i + 1));
(*returnColumnSizes)[i] = i + 1;
for (int j = 0; j < i + 1; j++) {
if (j == 0 || j == i) {
ret[i][j] = 1;
continue;
}
ret[i][j] = ret[i - 1][j - 1] + ret[i - 1][j];
}
}
return ret;
}