Find Middle Node
Easyjavapythonccppjavascript
Find the middle node of a singly linked list. If the list has an even number of nodes, return the second of the two middle nodes.
Input Format
The first line contains an integer N. The second line contains N space-separated integers.
Output Format
Print the value of the middle node.
Example 1
Input
5 1 2 3 4 5
Output
3
Explanation: 3 is the middle node.
- 1 <= N <= 100000
- -1000000000 <= value <= 1000000000