Dsa
Linked List
Easy
Find the Middle of the Linked List
Given a singly linked list, find the middle node of the list. If there are two middle nodes, return the second middle node.
Input Format:
- First line: An integer n (the number of nodes).
- Second line: n space-separated integers representing the nodes of the linked list.
Output Format:
- A single line with the value of the middle node.
Example:
Input:
5
1 2 3 4 5
Output:
3
Key concepts
linked_listfindingmiddle
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now