Middle of Linked List

medium

Find the middle node of a linked list in a single pass

Middle of Linked List

Key Insight

When fast reaches the end, slow is exactly at the middle

Step 1Setup
slow
fast
1
2
3
4
5
null

Both slow and fast start at head node 1.

1 / 5
Practice the Code

Step-by-Step Walkthrough: Middle of Linked List

When fast reaches the end, slow is exactly at the middle

  1. Setup

    Both slow and fast start at head node 1.

  2. Step 1

    Slow moves to 2. Fast jumps to 3.

  3. Step 2

    Slow moves to 3. Fast jumps to 5.

  4. Fast at End

    Fast has reached the last node (no next). Slow is at the middle.

  5. Result

    Middle node is 3. Return the sublist starting from node 3.