← All problems

Reverse Nodes in k-Group

Hard linked listsrecursion LeetCode ↗
Reverse the list k nodes at a time; leave the remainder as-is.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n), Space O(n/k) recursion

Common pitfalls

  • Reversing a short final group
  • Losing the connection between groups

Your solution

Log in to save your code and track progress.