Midpoint of a Linked List — Coding Question

Problem Statement:

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.

Remember/Consider :

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 :

Sample Output 1 :

Sample Input 2 :

Sample Output 2 :


Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store