Convert LL into array ; Python Solution
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```python3 []\n# Definition for singly-linked list.\n# class ListNode:\n#     def __init__(self, val=0, next=None):\n#         self.val = val\n#         self.next = next\nclass Solution:\n    def splitListToParts(self, head: Optional[ListNode], k: int) -> List[Optional[ListNode]]:\n        def helper(temp):\n            dummy = ListNode(0)\n            node = dummy\n            for i in temp:\n                node.next = ListNode(i)\n                node = node.next\n            return dummy.next\n\n        arr = []\n        node = head\n\n        while node:\n            arr.append(node.val)\n            node = node.next\n\n        out = []\n        if len(arr) <= k:\n            e = k - len(arr)\n            for i in arr:\n                out.append(ListNode(i))\n            while len(out) < k:\n                out.append(None)\n            return out\n\n        l = len(arr)\n        group = l // k\n        rem = l % k\n        temp = []\n\n\n        g = group + (1 if rem > 0 else 0)\n        for i in arr:\n            temp.append(i)\n            if g > 1:\n                g -= 1\n            else:\n                out.append(helper(temp))\n                temp = []\n                rem -= 1\n                g = group + (1 if rem > 0 else 0)\n        if temp:\n            out.append(helper(temp))\n        return out\n        \n\n\n```
['Linked List', 'Python', 'Python3']