Question
Winner of The LinkedList Game
You are given the head of 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 0 and 1 are a pair, the nodes with indices 2 and 3 are 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".

Input
User task:
Since this will be a functional problem, you don't have to take input. You just have to complete the function gameResult() that takes the head of the linked list as a parameter.

Constraints:
The number of nodes in the list is in the range [2, 100].
The number of nodes in the list is even.
1 <= Node.val <= 400
We are considering it as 0-indexed.
The value of each odd-indexed node is odd.
The value of each even-indexed node is even.
Output
If the points of the even team are higher than the points of the odd team, return "Even". If the points of the odd team are higher than the points of the even team, return "Odd". If both teams have the same number of points, return 'Tie
Example
Input:
6
2 5 4 7 20 5
Output:
Odd

Explanation:
There are 3 pairs in this linked list.

(2,5) -> Since 2 < 5, The Odd team gets the point.

(4,7) -> Since 4 < 7, The Odd team gets the point.

(20,5) -> Since 20 > 5, The Even team gets the point.

The Odd team earned 2 points while the Even team got 1 point and the Odd team has the higher points.

Hence, the answer would be "Odd".

Input:
6
2 1 8 5 10 7
Output:
Even

Online