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.
Great except the first three lines of the function are redundant. You will still fall through to return 0, because in case head is null, fast = null and you skip the while loop altogether.
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
Great except the first three lines of the function are redundant. You will still fall through to return 0, because in case head is null, fast = null and you skip the while loop altogether.