What loop condition is needed before moving fast two steps?

Practice this question from Middle of the Linked List - Fast and slow pointers Pattern Practice Quiz, with options and an explanation.

Question

What loop condition is needed before moving fast two steps?

Option A — Correct answer

fast is not null and fast.next is not null

Option B

slow is null

Option C

head value is positive

Option D

list length is odd

Explanation

Check that fast is not null and fast.next is not null.

Middle of the Linked List - Fast and slow pointers Pattern Practice Quiz

All questions · Previous question

Open on QuizMaker