Clean C++
\nclass Solution {\npublic:\n    //Get the length of LinkedList\n    int getListLength(ListNode* head) {\n        int l = 0;\n        while(head) {\n           
```\nclass Solution {\npublic:\n    //Get the length of LinkedList\n    int getListLength(ListNode* head) {\n        int l = 0;\n        while(head) {\n            l++;\n            head = head->next;\n        }\n        return l;\n    }\n    vector<ListNode*> splitListToParts(ListNode* head, int k) {\n        vector<ListNode*> result(k, NULL);\n        int length = getListLength(head);\n        int size   = length/k;\n        int extra  = length%k;\n        int i      = 0;\n        \n        while(head) {\n            int s = size;\n            result[i++] = head;\n            ListNode* last = head, *prev = head;\n            \n            //Minimum size (MUST)\n            while(s-- > 0 && last) {\n                prev = last;\n                last = last->next;\n            }\n            \n            //Extra nodes\n            if(extra-- > 0 && last) {\n                prev = last;\n                last = last->next;\n            }\n            \n            if(prev) {\n                head = prev->next;\n                prev->next = NULL;\n            }\n        }\n        \n        return result;\n    }\n};\n```
[]