Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Reverse Nodes in K-Group
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Reverse nodes of a linked list in groups of size k.
Sample Input:
[1,2,3,4,5], 2
Sample Output:
[2,1,4,3,5]
Hints
Hint 1
Reverse k nodes at a time
Hint 2
Connect reversed groups properly
Hint 3
Handle remaining nodes if less than k
Code Editor
Reset
Run
Save
Loading...