Fast Accepted C code || O(2n)
Complexity\n- Time complexity: O(2n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \n\n# C\n\ns
# Complexity\n- Time complexity: O(2n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# C\n```\nstruct ListNode** splitListToParts(struct ListNode* head, int k, int* returnSize){\n\n    *returnSize = k;\n    struct ListNode **ListArr = (struct ListNode *)malloc(sizeof(struct ListNode)*k);\n\n    int n=0; struct ListNode *temp=head; // To find no. of elements\n    while(temp){\n        n++; temp=temp->next;\n    }\n\n    int r=n%k, size; n/=k;\n    ListArr[0]=temp=head;\n\n    for(int i=1; i<k; i++){\n        if(!temp && r<1) ListArr[i] = NULL;\n        else{\n            size = r--<1? n : n+1;\n            while(--size)\n                temp=temp->next;\n            ListArr[i] = temp->next;\n            temp->next=NULL;\n            temp=ListArr[i];\n        }\n    }\n    return ListArr;\n}\n```\n## Tom need a UPVOTE : |\n![waiting-tom-and-jerry.gif](https://assets.leetcode.com/users/images/4f0cc754-71e1-4cfc-816b-36a94c20b17f_1678366238.9546802.gif)
['Array', 'Linked List', 'C', 'C++']