Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Odd Even Linked List
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given a linked list, group all odd nodes together followed by even nodes.
Sample Input:
[1,2,3,4,5]
Sample Output:
[1,3,5,2,4]
Hints
Hint 1
Maintain two pointers: odd and even
Hint 2
Connect odd nodes together and even nodes together
Hint 3
Connect the end of odd list to start of even list
Code Editor
Reset
Run
Save
Loading...