Skip to main content
LeetCode 876, Easy. Topics: Linked List, Two Pointers. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 14 parametrized pytest cases, and a playground notebook:

Problem

Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node.

Examples

Example 1
Explanation: The middle node of the list is node 3. Example 2
Explanation: Since the list has two middle nodes with values 3 and 4, we return the second one.

Constraints

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

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

Grind 75, Grind, NeetCode All.
Last modified on August 25, 2026