Find the middle element of the given linked list
Given a linked list with an odd number of items, you are asked to find the middle element and print its value.
Input
The input is read automatically. You donβt need to do anything.
Output
The program should print the value of the middle element of the given linked list.
Examples
Input | Output |
5
4 2 9 8 -4 | 9 |
Β
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB