Reverse nodes in-place group by group using pointer rewiring.
For each group:
groupPrev. If fewer than k nodes remain, stop.groupNext.groupPrev to the new head (k-th), then move groupPrev to the old head.Each group is reversed independently while maintaining correct connections to the rest of the list.
Reverse nodes in-place group by group using pointer rewiring.
For each group:
groupPrev. If fewer than k nodes remain, stop.groupNext.groupPrev to the new head (k-th), then move groupPrev to the old head.Each group is reversed independently while maintaining correct connections to the rest of the list.