Clear C solution 🚀 Let's find best solution together
If you have any thought feel free leave a comment below\n\n# Code\n\n/** Note: The returned array must be malloced, assume     */\n/** caller calls free().     
**`If you have any thought feel free leave a comment below`**\n\n# Code\n```\n/** Note: The returned array must be malloced, assume     */\n/** caller calls free().                                  */\nint *plusOne(int *digits, int digitsSize, int *returnSize) {\n    *returnSize = digitsSize;\n    int *plusOne = malloc(digitsSize * sizeof(int));\n    if (plusOne == NULL)\n        return (NULL);\n    for (int i = 0; i < digitsSize; i++)\n        plusOne[i] = digits[i];\n    \n    plusOne[digitsSize - 1]++;\n    for (int i = digitsSize - 1; i - 1 >= 0; i--)\n        if (plusOne[i] == 10) {\n            plusOne[i] = 0;\n            plusOne[i - 1]++;\n        }\n\n    if (plusOne[0] == 10) {\n        (*returnSize)++;\n        plusOne = realloc(plusOne, *returnSize * sizeof(int));\n        if (plusOne == NULL)\n            return (NULL);\n        memmove(plusOne + 1, plusOne, digitsSize * sizeof(int));\n        plusOne[0] = 1;\n        plusOne[1] = 0;\n    }\n    return (plusOne);\n}\n\n```\n1) In the first part we just take memory for return array, and copy source array there\n2) In the second part we add one to the last element. Go through elements of array from the end and on 10, we split it\n3) In the last part we work with first element equal to 10. If it is so, we need to realloc memory and move an array by one element\n
['C']