Python | Easy Explanation | Explained main concept behind solution
STEPS :\n- Find length of linkedlist and store in variable \'n\'\n- Find quotient and remainder of length \'n\' and size \'k\'\n- If there are 8 nodes in linked
# **STEPS :**\n- Find length of linkedlist and store in variable \'n\'\n- Find quotient and remainder of length \'n\' and size \'k\'\n- If there are 8 nodes in linkedlist and size is 3 , then we need to split as [[1,2,3],[4,5,6],[7,8]] but not [[1,2],[3,4,5],[6,7,8]]\n- Inorder to achieve this we are using quotient+(i<remiander)-1 formula.\n- **NOTE :**  **IN PYTHON THE BELOW STATEMENTS ARE VALID**\n- **5 + (2<3) = 5 + True = 5 + 1 = 6**\n- **8 + (2>3) = 8 + False = 8 + 0 = 8**\n- In the above example with n=8 and k=3 , we are looping one more time to inner loop by checking whether outer loop variable \'i\' is less than \'remiander\', Thus adding 1 more loop to inner loop variable when i=0 and i=1. \n- At i=2, i<remainder return False, i.e, 0 so inner loops runs as usual.\n# Code\n```\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        curr = head\n        length = 0\n        while curr is not None:\n            curr = curr.next\n            length += 1\n        quotient, remainder = divmod(length,k)\n        curr = head\n        final_array = []\n        for i in range(k):\n            temp = curr\n            for j in range(quotient + (i < remainder) - 1):\n                if curr:\n                    curr = curr.next\n            if curr:\n                x = curr.next\n                curr.next = None\n                curr = x\n            final_array.append(temp)\n        return final_array\n                \n\n\n\n            \n\n```
['Python3']