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

Middle Node of a Linked List

Adobe logoAdobe● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: You return the value in the middle node of a singly linked list. Two Adobe intern reports are the source, each with a one-line question. One is from a product intern hired through a 2024 on-campus drive (August 2024, selected). It was the last question of their only interview, asked because time was left. The author described two ways to solve it. The other is from Adobe's SheCodes 2021 intern hiring (January 2022). It is looser. The first coding question of its interview, after an online test and a CV screen, asks for a node's middle element without naming any list. Reading that line as this linked-list task is our own interpretation. Neither report gives a rule for even lengths, limits or examples.

We chose these rules. We return the middle node's value. For an even number of nodes, the second of the two middle nodes counts. Lists have 1 to 1000 nodes, with values from -10^5 to 10^5. We wrote new examples.

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

Given the head of a singly linked list, return the value stored in its middle node.

If the list has n nodes, the middle node is the one with n / 2 nodes before it (rounded down, counting from 0). So for an even number of nodes there are two middle nodes, and you return the second one.

Function

middleValue(head: ListNode) → int

Examples

Example 1

head = [8,-3,6,1,9]return = 6
head
8-3619

Five nodes: the middle one is the third, with value 6. Two nodes come before it and two after it.

Example 2

head = [4,7,2,5]return = 2
head
4725

Four nodes have two middle nodes, the second (7) and the third (2). We return the second of the two middle nodes, so the answer is 2.

Example 3

head = [-12]return = -12
head
-12

A one-node list: its only node is the middle.

Constraints

  • The list has between 1 and 1000 nodes.
  • -10^5 <= node.val <= 10^5

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Middle of a Linked ListCisco · PHONE SCREENCisco interview questions
  • 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
  • Reverse a Singly Linked ListBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Merge Two Sorted Linked ListsExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions

Interview reports that mention this question

  • Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)
  • Adobe Intern Interview Questions: 54 Experiences (Part 1 of 4)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
All Adobe interview questionsSee Adobe 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 int middleValue(ListNode head) {
        // Write your code here.
    }
}
Checking account…