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 find_mid()
function which will take a linked list as an input and 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 singly linked list.
Output
The integer value of the middle node.
Sample Input
LinkedList = 7->14->10->21
Sample Output
14
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.