Close
Topic list
EASY
20 mins
Topics (Covered in this problem)
Problem solved
Skill meter
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Contributed by
Ashwani
Easy
0/40
Avg time to solve 20 mins
Success Rate 80 %
Share

## Problem Statement

#### Since the number of elements in this linked list is 4 so we have 2 middle elements, i.e. 2 and 3, but we return 3 as it is farther from the head node, i.e. 1.

Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1 :
``````2
1 2 3 4 5 -1
4 0 32 5 48 6 -1
``````
##### Sample Output 1 :
``````3
5
``````
##### Explanation Of Sample Input 1 :
``````For the first test case:

We can clearly see that there are 5 elements in the linked list and the middle element is 3 hence we return a pointer poiniting to the middle element i.e 3.

For the second test case:

The linked List is : 4->0->32->5->48->6->NULL

We have 6 elements in the linked list. we will have 2 middle elements i.e 32 and 5. Since it is specified to return the element farther from the root node, we return 5.
``````
##### Sample Input 2 :
``````2
2 69 7 -1
1 4 5 8 9 6 3 -1
``````
##### Sample Output 2 :
``````69
8
``````
Auto
Console