We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Given the head of a Linked-List and a number k, reverse every alternating ‘k’ sized group from the head.
k
If, in the end, you are left with a group with less than ‘k’ elements, reverse it too.
E.g.
k = 2
1->2->3->4->5->6->7->8->null
2->1->3->4->6->5->7->8->null