...

/

Reverse Alternate K Nodes in a Singly Linked List

Reverse Alternate K Nodes in a Singly Linked List

Given a singly linked list and an integer 'k' reverse every 'k' element.

Statement

Given a singly linked list and an integer k, write a function to reverse every k element.

  • If k<=1k <= 1, then the input list is unchanged.
  • If k>=nk >= n
...
Access this course and 1400+ top-rated courses and projects.