Linked List Manipulation

Asked at Amazon · Coding & Leetcode-style Questions · Difficulty: Medium

Given a singly linked list, reverse the list starting from the middle and return the new head node. Assume the number of nodes in the list is odd. The input is the head node of the list, and the output is the new head node. Implement with $O(n)$ time complexity and $O(1)$ space complexity.

Loading the problem…