You are given a singly linked list and a whole number k. Cut the list into k parts, one after the other.
The parts should be as equal in size as possible: the sizes of any two parts differ by at most one. A part may be empty when the list is shorter than k.
The parts keep the order of the original list. Parts that come earlier are never smaller than parts that come later.
Return the k parts as a list.
Give your answer back as an array of arrays, one inner array for each part. An empty part is shown as [].
How the judge passes the data
Examples
Example 1:
Input: head = [1,2], k = 4
Output: [[1],[2],[],[]]
Explanation: There are only 2 nodes for 4 parts, so the last two parts are empty.
Example 2:
Input: head = [1,2,3,4,5,6,7], k = 3
Output: [[1,2,3],[4,5],[6,7]]
Explanation: 7 nodes into 3 parts gives sizes 3, 2 and 2. The bigger part comes first.
Example 3:
Input: head = [5,6,7,8], k = 2
Output: [[5,6],[7,8]]
Explanation: 4 nodes split evenly into two parts of size 2.