...

/

Solution Review: Problem Challenge 1

Solution Review: Problem Challenge 1

Reverse alternating K-element Sub-list (medium)

Given the head of a LinkedList and a number ‘k’, reverse every alternating ‘k’ sized sub-list starting from the head.

If, in the end, you are left with a sub-list with less than ‘k’ elements, reverse it too.

Solution

The problem follows the In-place Reversal of a LinkedList pattern and is quite similar to ...