3062. Winner of the Linked List Game
You are given the
headof a linked list of even length containing integers.Each odd-indexed node contains an odd integer and each even-indexed node contains an even integer.
We call each even-indexed node and its next node a pair, e.g., the nodes with indices
0and1are a pair, the nodes with indices2and3are a pair, and so on.For every pair, we compare the values of the nodes in the pair:
- If the odd-indexed node is higher, the
"Odd"team gets a point.- If the even-indexed node is higher, the
"Even"team gets a point.Return the name of the team with the higher points, if the points are equal, return
"Tie".
1 | /** |