100% Faster in java with simple logic
\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val)
```\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val) { this.val = val; }\n *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }\n * }\n */\nclass Solution {\n    public ListNode[] splitListToParts(ListNode head, int k) {\n        int length = 0;\n        ListNode temp = head;\n        while (temp != null) {\n            length++;\n            temp = temp.next;\n        }\n\n        int partSize = length / k;\n        int extra = length % k;\n        ListNode[] result = new ListNode[k];\n        temp = head;\n        for (int i = 0; i < k; i++) {\n            \n            if(temp==null) break;\n            ListNode currNode = temp;\n            ListNode prev = null;\n            int size=0;\n            while(temp != null && size<partSize)\n            {\n                prev = temp;\n                temp = temp.next;\n                size++;\n            }\n            if(extra > 0)\n            {\n                prev = temp;\n                temp = temp.next;\n                extra--;\n            }\n            prev.next = null;\n            result[i] = currNode;\n            \n           \n        }\n        return result;\n    }\n}\n```
['Linked List']