Challenge: Find Middle Node of Linked List
Here's another interesting coding challenge to test your knowledge on linked lists.
We'll cover the following
Problem Statement
You have to implement the findMid()
function which is a member function of a LinkedList
and it should return the value of the middle node. If the length of the list is even, the middle value will occur at . For a list of odd length, the middle value will be .
Input
A linked list.
Output
Middle element of the linked list.
Sample Input
LinkedList = 7->14->10->21->null
Sample Output
14
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.