Given a linked list A , reverse the order of all nodes at even positions.
Problem Constraints
1 <= Size of linked list <= 100000
Input Format
First and only argument is the head of the Linked-List A.
Output Format
Return the head of the new linked list.
Example Input
Input 1:
A = 1 -> 2 -> 3 -> 4
Input 2:
A = 1 -> 2 -> 3
Example Output
Output 1:
1 -> 4 -> 3 -> 2
Output 2:
1 -> 2 -> 3
Example Explanation
Explanation 1: