Computer Science, asked by bunnysrocks43, 4 days ago

Given a linked list, return the linked list after rearranging the nodes in a spiral fashion i.e. start from the center and move towards the end, picking a node from the left side and then the right side from the center.
Example: Input: 1-2-3-4-5-6-7
Output: 4-3-526-17

Explanation: 4 is at the center Input: 1-2-3-4-5-6 Output: 34-25-1-6 Explanation: Center is in between 3 and 4 Expected time complexity: O(n) Expected space complexity: 0(1) n = number of nodes in the linked list​

Answers

Answered by girikhushboo77
0

Answer:

make sure all words are spelled correctly

Similar questions