Easy C++ Solution
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```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    vector<ListNode*> splitListToParts(ListNode* head, int k) {\n        vector<ListNode*> ans;\n        ListNode* temp = head;\n        int len = 0;\n        while(temp!=NULL){\n            len++;\n            temp = temp->next;\n        }\n        temp = head;\n        ListNode* prev = temp;\n        if(len<k){\n            for(int i=0;i<len;i++){\n                prev  = temp;\n                head = temp;\n                temp = temp->next;\n                prev->next = NULL;\n                ans.push_back(head);\n            }\n            for(int i=0;i<k-len;i++){\n                ans.push_back(NULL);\n            }\n            return ans;\n        }\n        int elements = len/k;\n        int rem = len%k;\n        while(rem>0){\n            head = temp;\n            for(int i=0;i<elements+1;i++){\n            prev = temp;\n            temp = temp->next;\n        }\n        prev->next = NULL;\n        ans.push_back(head);\n        rem--;\n        }\n        while(temp!=NULL){\n            prev = temp;\n            head = temp;\n            for(int i=0;i<elements;i++){\n                prev = temp;\n                temp = temp->next;\n            }\n            prev->next =NULL;\n            ans.push_back(head);\n        }\n        return ans;\n    }\n};\n```
['C++']