What's wrong with my C codes?


  • 0
    G
    int** generate(int numRows, int** columnSizes, int* returnSize) {
        int** column;
        *returnSize = numRows;
        column = (int **)malloc(sizeof(int *)*numRows);
        *columnSizes=(int *)malloc(sizeof(int)*numRows);
        for (int i=0;i<numRows;i++)
        {
            columnSizes[i]=i+1;
            column[i]=(int *)malloc(sizeof(int)*(i+1));
            column[i][0]=1;
            column[i][i]=1;
            for (int j=1;j<i;j++)
                column[i][j]=column[i-1][j]+column[i-1][j-1];
        }
        return column;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.