#20

Middle of the Linked List

Easy
All Problems

20. Middle of the Linked List#876

Easy🔗 Linked ListFast & Slow Pointers

Find the middle node of a linked list.

Examples

Example 1:
Input: [[1,2,3,4,5]]
Output: [3,4,5]
Example 2:
Input: [[1,2,3,4,5,6]]
Output: [4,5,6]
Example 3:
Input: [[1]]
Output: [1]

Why learn this

Fast/slow pointer pattern in its simplest form. Directly prepares you for Medium problems.

Linked ListsTwo Pointers
Python 3Loading Python engine...
Click "Run Code" to test your solution