Midpoint of a Linked List — Coding Question
For a given singly linked list of integers, find and return the node present at the middle of the list
Input format :
The first line contains the elements of the singly linked list separated by a single space.
While specifying the list elements for input, -1 indicates the end of the singly linked list and hence, would never be a list element
Output Format :
For each test case/query, print the data value of the node at the middle of the given list.
Output for every test case will be printed in a seperate line.
Sample Input 1 :
1 2 3 4 5 -1
Sample Output 1 :
Sample Input 2 :
1 2 3 4 -1
Sample Output 2 :