C++ Solution O(1) Space 9ms
\nclass Solution {\npublic:\n    vector<ListNode*> splitListToParts(ListNode* root, int k) {\n        int len = 0;\n        for (ListNode *x = root; x; ++len, x
```\nclass Solution {\npublic:\n    vector<ListNode*> splitListToParts(ListNode* root, int k) {\n        int len = 0;\n        for (ListNode *x = root; x; ++len, x = x->next);\n\n        int n = len / k, r = len % k;\n        vector<ListNode*> ret(k);\n        for (int i = 0; i < k && root; ++i) {\n            ret[i] = root;\n            for (int j = 1; j < n + (i < r); ++j)\n                root = root->next;\n            ListNode *next = root->next;\n            root->next = nullptr;\n            root = next;\n        }\n        return ret;\n    }\n};\n```
[]