reverseKGroup = function(head, k) {
    const sentinel = tail = new ListNode(0, head);

    while (true) {
        let [ start, last ]= moveNode(tail, k);
        if (!last) break;

        reverse([ start, tail.next, start ])

        const next = tail.next;
        tail.next = last;
        tail = next;
    }

    return sentinel.next;
}
https://leetcode.com/problems/reverse-nodes-in-k-group/
Time O(N) | Space O(N)
@param {ListNode} head
@param {number} k
@return {ListNode}