Simple Solution | 100 % Beats | Java
\n\n# Code\njava []\nclass Solution {\n    public ListNode[] splitListToParts(ListNode head, int k) {\n        ListNode[] result = new ListNode[k];\n        if(
\n\n# Code\n```java []\nclass Solution {\n    public ListNode[] splitListToParts(ListNode head, int k) {\n        ListNode[] result = new ListNode[k];\n        if(head == null) return result;\n\n        int len = 0;\n        ListNode curr = head;\n        while(curr != null) {\n            curr = curr.next;\n            len++;\n        }\n\n        int div = len / k;\n        int mod = len % k;\n        int interval = div + 1;\n        int ind = 0;\n        curr = head;\n        ListNode prev = null;\n        \n        for(int i = 0; i < mod; i++) {\n            result[ind++] = curr;\n            for(int j = 0; j < interval; j++) {\n                prev = curr;\n                curr = curr.next;\n            }\n            prev.next = null;\n        }\n\n        if(curr != null)\n\n        while(curr != null) {\n            result[ind++] = curr;\n            for(int j = 0; j < interval - 1; j++) {\n                if(curr == null) break;\n                prev = curr;\n                curr = curr.next;\n            }\n            prev.next = null;\n        }\n        return result;\n    }\n}\n```
['Java']