Statement
In a linked list with an even number of nodes (
For example, if
The node at index
pairs with the node at index . The node at index
pairs with the node at index .
The twin sum is the sum of a node’s value and its twin’s value. Given the head of a linked list with an even number of nodes, return the maximum twin sum among all pairs.
Constraints:
The list contains an even number of nodes in the range
. Node.value