educative.io

Point of possible null

Hi,
In the problem above,
It’s suggested to use fast.next.next to find cycle. But we might have fast.next == null.

Hi, according to this loop in the solution “while (fast != null && fast.next != null)” the loop would break fast.next will equal to null and this would mean that it is a non-cyclic linked list.

1 Like