C solution with comments.
\n    int* plusOne(int* digits, int digitsSize, int* returnSize) {\n    int carry = 1, i = digitsSize;\n    int* ret = (int*)malloc(sizeof(int)*(digitsSize+1));
    \n    int* plusOne(int* digits, int digitsSize, int* returnSize) {\n    int carry = 1, i = digitsSize;\n    int* ret = (int*)malloc(sizeof(int)*(digitsSize+1));\n    while (i > 0) {\n        ret[i] = (digits[i-1]+carry)%10;\n        carry = (digits[i-1]+carry)/10;\n        i--;\n    }\n    if (!ret[1]) { \n        // size increased 1, set the first digit\n        ret[0] = 1;\n        *returnSize = digitsSize+1;\n        return ret;\n    } else {\n        *returnSize = digitsSize;\n        return ret+1;\n    }
[]