楼主: 
dont   2024-09-08 11:52:17725. Split Linked List in Parts
## 思路
先计算node的数量,
除k得到每堆的node数量, 剩下的余数平均给前r堆
## Code
```python
class Solution:
    def splitListToParts(self, head: Optional[ListNode], k: int) ->
List[Optional[ListNode]]:
        curr = head
        count = 0
        while curr:
            count += 1
            curr = curr.next
        count, remains = divmod(count, k)
        res = []
        curr = head
        for i in range(k):
            res.append(curr)
            for _ in range(count+(i < remains)-1):
                curr = curr.next
            if curr:
                curr.next, curr = None, curr.next
        return res
```