Given a singly linked list, reorder its nodes such that all nodes at even indices appear before nodes at odd indices. The relative order of nodes within the even and odd groups must be preserved.
Explanation: Even-indexed nodes (2, 4) appear before odd-indexed nodes (1, 3, 5)
Explanation: Even-indexed node (2) appears before odd-indexed nodes (1, 3)
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak