Solution in C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\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# Code\n```\nclass Solution {\npublic:\n    vector<ListNode*> splitListToParts(ListNode* head, int k) {\n        vector<ListNode*>ans;\n        int len=0;\n        ListNode*temp=head;\n        while(temp)\n        {\n            len++;\n            temp=temp->next;\n        }\n        int size=len/k;\n        int rem=len%k;\n        temp=head;\n        for(int i=0;i<k;i++)\n        {\n            ListNode*end=temp;\n            if(rem>0)\n            {\n                int c=size;\n                while(c--)\n                {\n                    end=end->next;\n                }\n                ListNode*x=end->next;\n                end->next=NULL;\n                ans.push_back(temp);\n                temp=x;\n                rem--;\n            }\n            else\n            {\n                if(size==0)\n                {\n                    ans.push_back(NULL);    \n                }\n                else\n                {\n                    int c=size-1;\n                    while(c--)\n                    {\n                    end=end->next;\n                    }\n                    ListNode*x=end->next;\n                    end->next=NULL;\n                    ans.push_back(temp);\n                    temp=x;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']