[C++] Iterative 4ms solution. [Detailed Explanation]
\n/*\n    https://leetcode.com/problems/split-linked-list-in-parts/submissions/\n    \n    Max equal nodes per group: N/k\n    remaining nodes, that needs to be
```\n/*\n    https://leetcode.com/problems/split-linked-list-in-parts/submissions/\n    \n    Max equal nodes per group: N/k\n    remaining nodes, that needs to be given in sequential manner starting from beginning: N % k\n    Idea is to traverse the required no. of nodes for each group, end the sublist and \n    add to the group and continue.\n    \n    TC: O(N), SC: O(1)\n*/\n\nclass Solution {\npublic:\n    // Finds no. of nodes in list\n    // TC: O(N)\n    int nodeCount(ListNode* head) {\n        int c = 0;\n        while(head) {\n            ++c;\n            head = head->next;\n        }\n        return c;\n    }\n    \n    // TC: O(N)\n    vector<ListNode*> splitListToParts(ListNode* root, int k) {\n        // N/k gives max equal no. of nodes per block. In order to keep the\n        // max diff 1, we add 1 from each of the remaining N % k elements\n        // to the groups from start\n        const int N = nodeCount(root);\n        \n        int elements_per_group = N / k;\n        int extra_nodes = N % k;\n        \n        vector<ListNode*> result(k);\n        \n        ListNode *curr = root;\n        \n        for(int i = 0; i < k; i++) {\n            int remaining = elements_per_group;\n            // if any extra nodes needs to added\n            if(extra_nodes > 0) {\n                remaining += 1;\n                --extra_nodes;\n            }\n\n            result[i] = curr;\n            ListNode *prev = nullptr;\n            // traverse the no. of nodes that will be assigned\n            while(remaining--) {\n                prev = curr;\n                curr = curr->next;\n            }\n            // end the list\n            if(prev)\n                prev->next = nullptr;\n        }    \n        \n        return result;\n    }\n};\n```
['C', 'C++']