- 關注代碼邏輯,是否死循環(但是這個在簡單的示例中就能發現)
- 前期申請空間太多,合理安排內存申請
// int **returnArr = (int **)malloc(sizeof(int *) * 1000);
// *returnColumnSizes = (int *)malloc(sizeof(int) * 1000);
int **returnArr = (int **)malloc(sizeof(int *) * (numsSize + 1) * 6);
*returnColumnSizes = (int *)malloc(sizeof(int) * (numsSize + 1) * 6);
3.注意釋放內存
/**
- Return an array of arrays of size *returnSize.
- The sizes of the arrays are returned as *returnColumnSizes array.
- Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
*/