c solution in 4ms
\n/**\n * Return an array of arrays of size *returnSize.\n * The sizes of the arrays are returned as *columnSizes array.\n * Note: Both returned array and *colu
```\n/**\n * Return an array of arrays of size *returnSize.\n * The sizes of the arrays are returned as *columnSizes array.\n * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().\n */\nint** flipAndInvertImage(int** A, int ARowSize, int *AColSizes, int** columnSizes, int* returnSize) {\n\t*returnSize = ARowSize;\n\tint colsize = *AColSizes;\n\tint** retarr = (int**)malloc(sizeof(void*) * ARowSize);\n\t*columnSizes = (int*)malloc(sizeof(int) * ARowSize);\n\tfor (int i = 0; i < ARowSize; i ++) {\n\t\tint* one = A[i];\n\t\tint* newone = (int*)malloc(sizeof(int) * colsize);\n\t\tfor (int j = 0; j < colsize; j ++) {\n\t\t\tint t = one[j];\n\t\t\tif (t == 1) t = 0;\n\t\t\telse t = 1;\n\t\t\tnewone[colsize - j - 1] = t;\n\t\t}\n\t\tretarr[i] = newone;\n\t\t(*columnSizes)[i] = colsize;\n\t}\n\treturn retarr;\n}\n\n```
[]