We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I don't believe your first check if the head is null is necessary because you default return 0 and the while loop is the only way to return 1 which checks if fast (initially set to head) is not null.
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
I don't believe your first check if the head is null is necessary because you default return 0 and the while loop is the only way to return 1 which checks if fast (initially set to head) is not null.