Back to DSA sheet

Reverse Nodes in k-Group

HardLinked List
Open on LeetCodeAmazonGoogleMicrosoft

Reverse the nodes of a linked list k at a time. Nodes that do not form a complete group of k are left as is.

Constraints
  • 1 <= k <= size <= 5000
  • 0 <= Node.val <= 1000
Sheets
Blind 75NeetCode 150NeetCode 250
reverse-nodes-in-k-group.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.