Approach hintTry it first, then revealHide
Move a slow pointer one step and a fast pointer two steps at a time; they meet if and only if the list contains a cycle. O(1) extra space.
Move a slow pointer one step and a fast pointer two steps at a time; they meet if and only if the list contains a cycle. O(1) extra space.