✅💯🔥Simple Code🚀📌|| 🔥✔️Easy to understand🎯 || 🎓🧠Beats 100%🔥|| Beginner friendly💀💯
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\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 */\n\n//           //////////////////ATISHAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\           \\\\\n//           \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\JAIN//////////////////           \\\\\n\nclass Solution {\n    public ListNode[] splitListToParts(ListNode head, int k) {\n        ListNode temp = head; int size=0;\n        while(temp!=null){\n            temp=temp.next;\n            size++;\n        }\n        ListNode[] ans = new ListNode[k];\n        temp=head;\n        int i=0;\n        int n=k;\n        if(k>size){\n            k=size;\n        }\n        while(temp!=null){\n            if(size%k==0){\n                ans[i]=temp; i++;\n                ListNode dummy = temp;\n                for(int j=1; j<size/k; j++){\n                    temp=temp.next;\n                }\n                dummy=temp;\n                temp=temp.next;\n                dummy.next=null;\n            } else{\n                ans[i]=temp; i++;\n                ListNode dummy = temp;\n                for(int j=1; j<size/k +1; j++){\n                    if(temp!=null){\n                        temp=temp.next;\n                    }\n                }\n                if(temp!=null){\n                    dummy=temp;\n                    temp=temp.next;\n                    dummy.next=null;\n                }\n                size--;\n            }\n        }\n        if(n>size){\n            while(i<n){\n                ans[i]=null;\n                i++;\n            }\n        }\n        return ans;\n    }\n}\n```\n\n![7be995b4-0cf4-4fa3-b48b-8086738ea4ba_1699897744.9062278.jpeg](https://assets.leetcode.com/users/images/fe5117c9-43b1-4ec8-8979-20c4c7f78d98_1721303757.4674635.jpeg)
['Linked List', 'C', 'Python', 'C++', 'Java']