FastPrepMiddle of a Linked List
Problems/Middle of a Linked List

Middle of a Linked List

Cisco logoCisco● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: In a Cisco interview, the first technical round had a networking and C part and a coding part. Another coding question was to find the middle of a singly linked list.

The post does not say which node to return when there are two middles, and gives no limits. Here you return the second middle node, and the list has 1 to 100 nodes with values from 1 to 100.

Our version is about 90% the same as the reported question.

You are given the head of a singly linked list. Return the middle node of the list.

If the list has two middle nodes, return the second one. The answer is shown as the values from the returned node to the tail.

Function

middleNode(head: ListNode) → ListNode

Examples

Example 1

head = [4,8,15,16,23]return = [15,16,23]
head
48151623
Removed
→
return
151623
Moved or new

The list has 5 nodes, so the middle is the third node, 15. From there the list reads 15, 16, 23.

Example 2

head = [3,1,4,1,5,9]return = [1,5,9]
head
314159
Removed
→
return
159
Moved or new

The list has 6 nodes, so there are two middle nodes: the third (4) and the fourth (1). Return the second one, the fourth node. From there the list reads 1, 5, 9.

Example 3

head = [42]return = [42]
head
42
→
return
42

A single node is its own middle.

Constraints

  • The number of nodes in the list is in the range [1, 100].
  • 1 <= Node.val <= 100

More Cisco interview questions

  • Check if a String Is a PalindromePHONE SCREEN · Seen Nov 2026
  • Find Unique ElementsPHONE SCREEN · Seen Nov 2026
  • First Letter to Appear TwicePHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Reverse a StringPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • K-Step Bit Flip with RetentionPHONE SCREEN · Seen Nov 2026
  • Longest Non-Repeating SubstringPHONE SCREEN · Seen Jul 2026
  • Todo Task Manager OperationsONSITE INTERVIEW · Seen Oct 2026
  • Find the Duplicate Number Without Modifying the ArrayONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Merge Two Sorted ListsIBM · PHONE SCREENIBM interview questions
  • Count Nodes in a ChainApple · PHONE SCREENApple interview questions
  • Detect a Cycle in a Linked ListSalesforce · PHONE SCREENSalesforce interview questions
  • Find the Intersection Node of Two Linked ListsVisa · PHONE SCREENVisa interview questions
  • Reverse a Linked ListMygate · PHONE SCREENMygate interview questions
  • Find the Intersection Node of Two Linked ListsLinkedIn · PHONE SCREENLinkedIn interview questions
  • Linked List Palindrome in Constant SpaceNVIDIA · PHONE SCREENNVIDIA interview questions
  • First Node Two Linked Lists ShareAdobe · PHONE SCREENAdobe interview questions
  • Reverse a Singly Linked ListBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Merge Two Sorted Linked ListsExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
All Cisco interview questionsSee Cisco hiring insights
Saved
/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode middleNode(ListNode head) {
        // Write your code here.
    }
}
Checking account…