C++ || Faster Than 99.17% Solution with Comments for Easy Understanding
\n\nclass Solution {\n    \n    int CountNodes(ListNode * head)\n    {\n        ListNode * temp = head;\n        int i = 0;\n        while(temp)\n        {\n   
```\n\nclass Solution {\n    \n    int CountNodes(ListNode * head)\n    {\n        ListNode * temp = head;\n        int i = 0;\n        while(temp)\n        {\n            i++;\n            temp = temp->next;\n        }\n        return i;\n    }\n    \npublic:\n    vector<ListNode*> splitListToParts(ListNode* head, int k) {\n        \n        vector<ListNode*> ans(k , NULL);\n        \n        int n = CountNodes(head);\n        \n        // x = No Of Nodes Each Part will Get at least\n        int x = n/k;\n        \n        // remaing Nodes after distributing equal Nodes and then giving one node to each part from starting\n        int y = n%k;\n        \n        ListNode * curr = head;\n        int pos = 0;\n        while(pos<k)\n        {\n            ans[pos++] = curr;\n            \n            ListNode * prev = NULL;\n            \n            //Move x Nodes forward\n            int i = x;\n            while(i && curr)\n            {\n                i--;\n                prev = curr;\n                curr = curr->next;\n            }\n            // Check condition for giving one extra node\n            if(y)\n            {\n                y--;\n                prev = curr;\n                curr = curr->next;\n            }\n            \n            // If Prev->next != NULL make it NULL To make it into parts\n            if(prev)\n                prev->next = NULL;\n        }\n        \n        return ans;\n    }\n};\n\n// Please Upvote If You like It , Thank You\n```
[]