Middle of the Linked List
Try to solve the Middle of the Linked List problem.
We'll cover the following
Statement
Given the head
of a singly linked list, return the middle node of the linked list. If the number of nodes in the linked list is even, there will be two middle nodes, so return the second one.
Constraints:
Let n
be the number of nodes in a linked list.
-
n
-
node.data
head
NULL
Examples
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy