Skip to content

ED-005. Reverse alternating k-Group #267

Closed
@hamidgasmi

Description

@hamidgasmi

Given the head of a Linked-List and a number k, reverse every alternating ‘k’ sized group from the head.

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

E.g.

  • Inputs: k = 2, 1->2->3->4->5->6->7->8->null
  • Output: 2->1->3->4->6->5->7->8->null

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions