Citi Interview Question

Given a linked list head, return true if there is a cycle or not.

Interview Answer

Anonymous

Dec 19, 2023

I used the fast and slow pointer approach and said if the fast pointer reaches the null pointer then return false. If not at some point in the cycle the two pointer will be pointing the same node and then if that's the case return true.