Easy Solution
\n\n# Complexity\n- Time complexity:O(n)\nWhere n is the number of nodes in the linked list. This is because we iterate through the linked list once to calculat
\n\n# Complexity\n- Time complexity:O(n)\nWhere n is the number of nodes in the linked list. This is because we iterate through the linked list once to calculate its length, and then iterate through it again to split it into parts.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(k)\nWhere k is the number of parts we are splitting the linked list into. This is because we are creating a vector of size k to store the head nodes of each part.\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int lengthLL(ListNode* head){\n        if(head == NULL) return 0;\n        int len = 0;\n        ListNode* temp = head;\n        while(temp != NULL){\n            len++;\n            temp = temp->next;\n        }\n        return len;\n    }\n    vector<ListNode*> splitListToParts(ListNode* head, int k) {\n        vector<ListNode*> ans(k, NULL);\n        int len = lengthLL(head);\n        int baseSize = len/k;\n        int extra = len%k;\n\n        ListNode* cur = head;\n        for(int i = 0; i<k; i++){\n            ListNode* partHead = cur;\n            int partSize = baseSize+(extra>0?1:0);\n            extra--;\n\n            for(int j = 1; j<partSize; j++){\n                if(cur){\n                    cur = cur->next;\n                }\n            }\n            if(cur){\n                ListNode* nextPartHead = cur->next;\n                cur->next = NULL;\n                cur = nextPartHead;\n            }\n            ans[i] = partHead;\n        }\n        return ans;\n    }\n};\n```
['Linked List', 'C++']