Back to exercises

Find Middle of Linked List

Advance a slow pointer by one step and a fast pointer by two steps. When the fast pointer reaches the end, the slow pointer will be at the middle.

Coding Exercises Easy O(n)

Find Middle of Linked List

Advance a slow pointer by one step and a fast pointer by two steps. When the fast pointer reaches the end, the slow pointer will be at the middle.

Return the middle node of a singly linked list.